paint.vue 15 KB

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