paint.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866
  1. <template>
  2. <view class="box">
  3. <view class="top" @click="goCarlist">
  4. <view class="left">
  5. <image :src="carInfo.brandLogo" mode="widthFix" class="brandLogo" v-if="carInfo.brandLogo">
  6. <img src="../../static/timg/nocar.png" alt="" class="brandLogo" v-else>
  7. <view class="car" v-if="carInfo.carModel">{{carInfo.carModel}}</view>
  8. <view class="car" v-else>暂无</view>
  9. </image>
  10. </view>
  11. <image src="../../static/img/big_rightArrow.png" mode=""
  12. style="width: 30rpx;height: 30rpx;"></image>
  13. </view>
  14. <view class="main" v-if="itemList">
  15. <view class="mainLeft">
  16. <view class="mainLeftLine" v-for="(item,index) in itemList" :class="{lineLeftActive:leftIndex==index}"
  17. @click="leftClick(item,index)">
  18. <span class="leftTitle">{{item.name}}</span>
  19. <view class="lineNum" v-show="item.num!=0">{{item.num}}</view>
  20. </view>
  21. </view>
  22. <view class="mainRight">
  23. <view class="rightTop">{{itemList[leftIndex].name}}</view>
  24. <view class="mainRightLine" v-for="(item2,index) in itemList[leftIndex].list" :key="index">
  25. <view class="itemTop" @click="changeState(item2)">
  26. <view class="itemName">{{item2.ItemName}}</view>
  27. <span class="rightState" v-if="item2.open==false">展开<image
  28. src="../../static/img/icon_arrow_down.png" mode=""
  29. style="width: 20rpx;height: 11rpx; padding: 5rpx 8rpx;"></image>
  30. </span>
  31. <span class="rightState" v-else>收起<image
  32. src="../../static/img/icon_arrow_up.png" mode=""
  33. style="width: 20rpx;height: 11rpx; padding: 5rpx 8rpx;"></image>
  34. </span>
  35. </view>
  36. <!-- -->
  37. <view class="itemBox" v-if="item2.open==true">
  38. <view class="type" :class="{orangeLine:item2.type==1}" @click="select(item2)">
  39. <view class="typeName" :class="{orangeColor:item2.type==1}">喷漆</view>
  40. <view class="priceBox">
  41. <view class="money"><span class="renminbi">¥</span>{{item2.PSalePrice?item2.PSalePrice:'0'}}
  42. </view>
  43. <view class="money old" v-if="item2.PShowScribingType==1"><span
  44. class="renminbi">¥</span>{{item2.PScribingPrice?item2.PScribingPrice:'0'}}</view>
  45. </view>
  46. </view>
  47. <view class="type marginLeft" :class="{orangeLine:item2.type==2}" @click="select2(item2)">
  48. <view class="typeName" :class="{orangeColor:item2.type==2}">钣金喷漆</view>
  49. <view class="priceBox">
  50. <view class="money"><span
  51. class="renminbi">¥</span>{{item2.BPSalePrice?item2.BPSalePrice:'0'}}</view>
  52. <view class="money old" v-if="item2.BPShowScribingType==1"><span
  53. class="renminbi">¥</span>{{item2.BPScribingPrice?item2.BPScribingPrice:'0'}}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 底部 -->
  61. <view class="bottom">
  62. <view class="bottomLeft">
  63. <view class="caidan" @click="caidanClick">
  64. <image src="../../static/timg/icon_qingdan@2x.png" mode="" class="caidanImg"></image>
  65. <view class="total" v-if="selectItemList.length>0">{{selectItemList.length}}</view>
  66. </view>
  67. <view>
  68. <view class="heji"> <span class="heji1">合计</span> <span class="hejiNum">¥{{sumMoney}}</span> </view>
  69. <view class="hejiMs">合计数量:{{selectItemList.length}}</view>
  70. </view>
  71. </view>
  72. <view class="settlement" @click="sure">确定</view>
  73. </view>
  74. <view class="caidanTk" v-show="qingdanShow" @click="qingdanShow=false">
  75. <view class="tkCont">
  76. <view class="caidanTkTop">
  77. <view class="tkTopTitle">已选项目</view>
  78. <view class="topTopright">
  79. <view class="empty" @click.stop="empty">清空</view>
  80. </view>
  81. </view>
  82. <view class="tkMain" @click.stop>
  83. <view class="selectItem" v-for="(item,index) in selectItemList" :key="index">
  84. <view class="name">{{item.name}}</view>
  85. <view class="priceRight">
  86. <view class="price">¥ {{item.money?item.money:0}}</view>
  87. <image @click="deleteItem(item,index)" src="../../static/img/icon_delete.png" mode=""
  88. style="width: 26rpx;height: 26rpx;margin-left: 10rpx;"></image>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. data() {
  99. return {
  100. carInfo: '',
  101. itemList: [],
  102. leftIndex: 0,
  103. selectItemList: [],
  104. sumMoney: 0,
  105. qingdanShow: false,
  106. }
  107. },
  108. onShow() {
  109. this.carInfo = this.$store.state.carInfo
  110. console.log("车=", this.carInfo);
  111. },
  112. onLoad() {
  113. this.getData();
  114. },
  115. methods: {
  116. sure(){
  117. if (this.selectItemList.length == 0) {
  118. uni.showToast({
  119. title: '请选择项目',
  120. icon: 'none',
  121. duration: 3000
  122. });
  123. return false;
  124. }
  125. uni.navigateTo({
  126. url:'paintSure?itemList='+JSON.stringify(this.selectItemList)
  127. })
  128. this.$store.commit('mutationsckshopInfo', "")
  129. },
  130. goCarlist() {
  131. uni.navigateTo({
  132. url: '../user/addCar/cailist'
  133. })
  134. },
  135. empty() {
  136. var that = this;
  137. uni.showModal({
  138. title: '提示',
  139. content: '确定要清空已选项目吗',
  140. success: function(res) {
  141. if (res.confirm) {
  142. that.selectItemList = [];
  143. that.sumMoney = 0;
  144. that.qingdanShow = false;
  145. that.getData();
  146. }
  147. }
  148. });
  149. },
  150. deleteItem(item, index) {
  151. // 更新数据
  152. for (var i = 0; i < this.itemList.length; i++) {
  153. let dic = this.itemList[i];
  154. dic.list.forEach((item2, index) => {
  155. if (item.id == item2.ID) {
  156. item2.type = 0;
  157. dic.num -= 1;
  158. }
  159. })
  160. }
  161. this.selectItemList.splice(index, 1);
  162. },
  163. caidanClick() {
  164. this.qingdanShow = !this.qingdanShow
  165. },
  166. select(item) {
  167. if (item.type != 1) {
  168. item.type = 1;
  169. } else {
  170. item.type = 0;
  171. }
  172. console.log('type==', item.type);
  173. this.sumNum();
  174. },
  175. select2(item) {
  176. if (item.type != 2) {
  177. item.type = 2;
  178. } else {
  179. item.type = 0;
  180. }
  181. console.log('type2==', item.type);
  182. this.sumNum();
  183. },
  184. sumNum() {
  185. let item = this.itemList[this.leftIndex];
  186. var count = 0;
  187. item.list.forEach((v, index) => {
  188. if (v.type != 0) {
  189. count += 1;
  190. }
  191. })
  192. item.num = count;
  193. //组合选中的
  194. if (this.selectItemList.length) {
  195. this.selectItemList = [];
  196. }
  197. this.sumMoney = 0;
  198. for (var i = 0; i < this.itemList.length; i++) {
  199. this.itemList[i].list.forEach((item, index) => {
  200. if (item.type == 1) {
  201. let dic = {
  202. "id": item.ID,
  203. "name": item.ItemName + "(喷漆)",
  204. "money": item.PSalePrice
  205. }
  206. this.selectItemList.push(dic);
  207. this.sumMoney += item.PSalePrice;
  208. } else if (item.type == 2) {
  209. let dic = {
  210. "id": item.ID,
  211. "name": item.ItemName + "(钣金喷漆)",
  212. "money": item.BPSalePrice
  213. }
  214. this.selectItemList.push(dic);
  215. this.sumMoney += item.BPSalePrice;
  216. }
  217. })
  218. }
  219. // console.log('selectItemList==', this.selectItemList);
  220. },
  221. changeState(item) {
  222. item.open = !item.open
  223. },
  224. leftClick(item, index) {
  225. this.leftIndex = index
  226. },
  227. getData() {
  228. uni.showLoading({
  229. title: '加载中'
  230. });
  231. this.$http('openSheetMetalSprayPaint/queryPackageList', {
  232. // id: this.id,
  233. }, 'GET').then(res => {
  234. uni.hideLoading();
  235. let List = res.data;
  236. List.forEach((item, index) => {
  237. for (const key in item) {
  238. item['num'] = 0
  239. }
  240. })
  241. for (var i = 0; i < List.length; i++) {
  242. List[i].list.forEach((item, index) => {
  243. for (const key in item) {
  244. item['open'] = false
  245. }
  246. })
  247. }
  248. this.itemList = List;
  249. // console.log('列表=', this.itemList);
  250. })
  251. },
  252. }
  253. }
  254. </script>
  255. <style>
  256. .box {
  257. min-height: 100vh;
  258. background-color: #f4f5f7;
  259. }
  260. .top {
  261. background-color: #FFFFFF;
  262. padding: 30rpx 20rpx;
  263. display: flex;
  264. justify-content: space-between;
  265. align-items: center;
  266. border-bottom: 1rpx solid #EEEEEE;
  267. }
  268. .left {
  269. display: flex;
  270. align-items: center;
  271. }
  272. .car {
  273. font-size: 28rpx;
  274. width: 600rpx;
  275. color: #333333;
  276. line-height: 40rpx;
  277. margin-left: 10rpx;
  278. /* 隐藏文字显示 ...不换行 */
  279. overflow: hidden;
  280. text-overflow: ellipsis;
  281. white-space: nowrap;
  282. }
  283. .brandLogo {
  284. width: 42rpx;
  285. height: 42rpx;
  286. }
  287. .main {
  288. display: flex;
  289. height: calc(100vh - 310rpx);
  290. }
  291. .mainLeft {
  292. width: 154rpx;
  293. background: #F4F5F7;
  294. }
  295. .leftTitle {
  296. color: #333333;
  297. font-size: 26rpx;
  298. }
  299. .lineNum {
  300. position: absolute;
  301. background: #FF270A;
  302. width: 40rpx;
  303. height: 26rpx;
  304. text-align: center;
  305. line-height: 26rpx;
  306. font-size: 20rpx;
  307. color: #FFFFFF;
  308. border-radius: 13rpx;
  309. top: 10rpx;
  310. right: 10rpx;
  311. }
  312. .lineLeftActive {
  313. background: #FFFFFF;
  314. font-weight: bold;
  315. }
  316. .mainRight {
  317. width: 596rpx;
  318. overflow-y: scroll;
  319. background-color: #FFFFFF;
  320. }
  321. .rightTop {
  322. padding: 13rpx 24rpx;
  323. background-color: #F9F9F9;
  324. font-size: 26rpx;
  325. color: #959595;
  326. line-height: 37rpx;
  327. }
  328. .mainRightLine {
  329. padding: 30rpx 0;
  330. margin: 0 24rpx;
  331. background-color: #FFFFFF;
  332. border-bottom: 1rpx solid #EEEEEE;
  333. }
  334. .itemTop {
  335. display: flex;
  336. justify-content: space-between;
  337. align-items: center;
  338. }
  339. .itemName {
  340. font-size: 28rpx;
  341. color: #333333;
  342. }
  343. .rightState {
  344. font-size: 24rpx;
  345. color: #666666;
  346. }
  347. .itemBox {
  348. display: flex;
  349. justify-content: space-around;
  350. /* border-bottom: 1rpx solid #EEEEEE; */
  351. padding-top: 30rpx;
  352. }
  353. .type {
  354. border-radius: 10rpx;
  355. border: 2rpx solid #CCCCCC;
  356. width: 50%;
  357. text-align: center;
  358. }
  359. .marginLeft {
  360. margin-left: 20rpx;
  361. }
  362. .typeName {
  363. height: 57rpx;
  364. color: #666666;
  365. font-size: 26rpx;
  366. line-height: 57rpx;
  367. border-bottom: 2rpx solid #EEEEEE;
  368. }
  369. .orangeLine {
  370. border: 2rpx solid #FF0000;
  371. }
  372. .orangeColor {
  373. color: #FF0000;
  374. }
  375. .renminbi {
  376. font-size: 22rpx;
  377. }
  378. .priceBox{
  379. display: flex;
  380. justify-content: center;
  381. align-items: center;
  382. }
  383. .money {
  384. height: 76rpx;
  385. line-height: 76rpx;
  386. font-size: 32rpx;
  387. color: #FF0000;
  388. }
  389. .old {
  390. color: #999999;
  391. text-decoration: line-through;
  392. }
  393. .main {
  394. display: flex;
  395. height: calc(100vh - 410rpx);
  396. }
  397. .mainscrollView {
  398. height: calc(100vh - 410rpx);
  399. padding-bottom: constant(safe-area-inset-bottom);
  400. padding-bottom: env(safe-area-inset-bottom);
  401. box-sizing: content-box;
  402. margin-bottom: 120rpx;
  403. }
  404. /* #ifdef MP-WEIXIN */
  405. .main {
  406. display: flex;
  407. height: calc(100vh - 310rpx);
  408. }
  409. .mainscrollView {
  410. height: calc(100vh - 310rpx);
  411. }
  412. /* #endif */
  413. .mainLeft {
  414. width: 146rpx;
  415. background: #F5F5F5;
  416. }
  417. .mainRight {
  418. width: 604rpx;
  419. }
  420. .mainLeftLine {
  421. color: #3C3C3C;
  422. padding: 30rpx 20rpx;
  423. font-size: 26rpx;
  424. text-align: left;
  425. position: relative;
  426. }
  427. .lineNum {
  428. position: absolute;
  429. background: #FF270A;
  430. width: 40rpx;
  431. height: 26rpx;
  432. text-align: center;
  433. line-height: 26rpx;
  434. font-size: 20rpx;
  435. color: #FFFFFF;
  436. border-radius: 13rpx;
  437. top: 10rpx;
  438. right: 10rpx;
  439. }
  440. .lineLeftActive {
  441. background: #FFFFFF;
  442. }
  443. .nock {
  444. width: 22rpx;
  445. height: 22rpx;
  446. border-radius: 50%;
  447. border: 2px solid #AEAEAE;
  448. margin-top: 2rpx;
  449. margin-right: 10rpx;
  450. }
  451. .imgPrivacy {
  452. width: 36rpx;
  453. height: 36rpx;
  454. /* margin-top: 2rpx; */
  455. /* margin-right: 10rpx; */
  456. }
  457. .contTopRight {
  458. display: flex;
  459. align-items: center;
  460. width: 38rpx;
  461. height: 36rpx;
  462. margin-right: 10rpx;
  463. }
  464. .contTop {
  465. display: flex;
  466. justify-content: space-between;
  467. }
  468. .listPackgeName {
  469. font-size: 26rpx;
  470. font-family: PingFangSC-Regular, PingFang SC;
  471. font-weight: 600;
  472. color: #3C3C3C;
  473. }
  474. .listPackgeMs {
  475. font-size: 22rpx;
  476. font-family: PingFangSC-Regular, PingFang SC;
  477. font-weight: 400;
  478. color: #999999;
  479. padding-top: 5rpx;
  480. line-height: 30rpx;
  481. }
  482. .contZk {
  483. border-bottom: 1px solid #EEEEEE;
  484. padding-bottom: 20rpx;
  485. }
  486. .goodsImg {
  487. width: 120rpx;
  488. height: 120rpx;
  489. border-radius: 11rpx;
  490. }
  491. .goodsItemLIne {
  492. display: flex;
  493. padding-top: 20rpx;
  494. padding-bottom: 20rpx;
  495. }
  496. .goodsCont {
  497. display: flex;
  498. flex-direction: column;
  499. justify-content: space-between;
  500. padding-left: 20rpx;
  501. }
  502. .goodsContTop {
  503. display: flex;
  504. justify-content: space-between;
  505. width: 400rpx;
  506. }
  507. .goodsItemName {
  508. font-size: 26rpx;
  509. font-weight: 400;
  510. color: #3C3C3C;
  511. width: 78%;
  512. }
  513. .salePrice {
  514. font-size: 32rpx;
  515. font-weight: 500;
  516. color: #FF4F00;
  517. }
  518. .replaceBox {
  519. width: 100rpx;
  520. }
  521. .replace {
  522. width: 75rpx;
  523. height: 37rpx;
  524. border-radius: 19rpx;
  525. border: 2rpx solid #B9B9B9;
  526. text-align: center;
  527. line-height: 35rpx;
  528. color: #707070;
  529. font-size: 22rpx;
  530. margin-left: 25rpx;
  531. }
  532. .contZkMain {
  533. padding-top: 20rpx;
  534. }
  535. .asa {
  536. width: 44rpx;
  537. height: 44rpx;
  538. line-height: 44rpx;
  539. text-align: center;
  540. background: #F4F5F7;
  541. font-size: 30rpx;
  542. }
  543. .goodsCOntBOttom {
  544. display: flex;
  545. justify-content: space-between;
  546. }
  547. .as {
  548. display: flex;
  549. }
  550. .goodsPrice {
  551. display: flex;
  552. justify-content: space-between;
  553. padding-top: 10rpx;
  554. }
  555. .goodsPriceNum {
  556. color: #F8F8F8;
  557. font-size: 28rpx;
  558. }
  559. .asNum {
  560. font-size: 24rpx;
  561. color: #333333;
  562. padding: 0 18rpx;
  563. height: 44rpx;
  564. line-height: 44rpx;
  565. background: #F4F5F7;
  566. margin-left: 1px;
  567. margin-right: 1px;
  568. }
  569. .itemNum {
  570. font-size: 24rpx;
  571. font-weight: 400;
  572. color: #999999;
  573. }
  574. .bottom {
  575. position: fixed;
  576. left: 0;
  577. bottom: 0;
  578. width: 100vw;
  579. height: 120rpx;
  580. background: #FFFFFF;
  581. box-shadow: 0px -2px 20px 0px rgba(153, 153, 153, 0.2);
  582. padding-bottom: constant(safe-area-inset-bottom);
  583. padding-bottom: env(safe-area-inset-bottom);
  584. box-sizing: content-box;
  585. z-index: 11;
  586. display: flex;
  587. justify-content: space-between;
  588. }
  589. .caidanImg {
  590. width: 50rpx;
  591. height: 50rpx;
  592. }
  593. .bottomLeft {
  594. display: flex;
  595. }
  596. .caidan {
  597. padding-left: 33rpx;
  598. padding-top: 35rpx;
  599. padding-right: 33rpx;
  600. position: relative;
  601. }
  602. .total {
  603. position: absolute;
  604. width: 40rpx;
  605. height: 26rpx;
  606. background: #FF270A;
  607. line-height: 26rpx;
  608. text-align: center;
  609. color: #FFFFFF;
  610. font-size: 20rpx;
  611. top: 25rpx;
  612. right: 15rpx;
  613. border-radius: 13rpx;
  614. }
  615. .heji1 {
  616. font-size: 24rpx;
  617. font-weight: 500;
  618. color: #666666;
  619. }
  620. .hejiNum {
  621. font-size: 32rpx;
  622. font-family: PingFangSC-Medium, PingFang SC;
  623. font-weight: 500;
  624. color: #FF4F00;
  625. }
  626. .hejiMs {
  627. font-size: 24rpx;
  628. padding-top: 5rpx;
  629. color: #999999;
  630. }
  631. .heji {
  632. padding-top: 23rpx;
  633. }
  634. .settlement {
  635. width: 203rpx;
  636. height: 74rpx;
  637. background: #D53533;
  638. border-radius: 37rpx;
  639. text-align: center;
  640. line-height: 74rpx;
  641. font-size: 30rpx;
  642. font-family: PingFangSC-Medium, PingFang SC;
  643. font-weight: 500;
  644. color: #FEFFFE;
  645. margin-top: 23rpx;
  646. margin-right: 32rpx;
  647. }
  648. .caidanTk {
  649. height: calc(100vh);
  650. width: 100vw;
  651. background: rgba(0, 0, 0, 0.6);
  652. position: fixed;
  653. left: 0;
  654. top: 0;
  655. }
  656. .tkCont {
  657. height: 70vh;
  658. /* margin-top: calc(40vh ); */
  659. position: absolute;
  660. left: 0;
  661. bottom: 0;
  662. }
  663. .caidanTkTop {
  664. width: 750rpx;
  665. height: 90rpx;
  666. background: #FFFFFF;
  667. border-radius: 24rpx 24rpx 0px 0px;
  668. display: flex;
  669. justify-content: space-between;
  670. }
  671. .topTopright {
  672. /* display: flex; */
  673. padding-top: 29rpx;
  674. margin-right: 24rpx;
  675. }
  676. .tkTopTitle {
  677. line-height: 90rpx;
  678. font-size: 30rpx;
  679. font-weight: 600;
  680. color: #3C3C3C;
  681. padding-left: 24rpx;
  682. }
  683. .empty {
  684. width: 86rpx;
  685. height: 42rpx;
  686. background: #EEEEEE;
  687. border-radius: 21rpx;
  688. text-align: center;
  689. color: #666666;
  690. font-size: 24rpx;
  691. line-height: 42rpx;
  692. }
  693. .tkMain {
  694. background: #FFFFFF;
  695. height: calc(70vh - 90rpx);
  696. }
  697. .selectItem {
  698. background-color: #FFFFFFF;
  699. padding: 30rpx 24rpx 0;
  700. display: flex;
  701. justify-content: space-between;
  702. color: #333333;
  703. font-size: 26rpx;
  704. align-items: center;
  705. }
  706. .priceRight {
  707. display: flex;
  708. align-items: center;
  709. }
  710. </style>