paint.vue 15 KB

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