paint.vue 14 KB

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