paint.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  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="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="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. this.sumMoney = this.sumMoney.toFixed(2);
  220. // console.log('selectItemList==', this.selectItemList);
  221. },
  222. changeState(item) {
  223. item.open = !item.open
  224. },
  225. leftClick(item, index) {
  226. this.leftIndex = index
  227. },
  228. getData() {
  229. uni.showLoading({
  230. title: '加载中'
  231. });
  232. this.$http('openSheetMetalSprayPaint/queryPackageList', {
  233. // id: this.id,
  234. }, 'GET').then(res => {
  235. uni.hideLoading();
  236. let List = res.data;
  237. List.forEach((item, index) => {
  238. for (const key in item) {
  239. item['num'] = 0
  240. }
  241. })
  242. for (var i = 0; i < List.length; i++) {
  243. List[i].list.forEach((item, index) => {
  244. for (const key in item) {
  245. item['open'] = false
  246. }
  247. })
  248. }
  249. this.itemList = List;
  250. // console.log('列表=', this.itemList);
  251. })
  252. },
  253. }
  254. }
  255. </script>
  256. <style>
  257. .box {
  258. min-height: 100vh;
  259. background-color: #f4f5f7;
  260. }
  261. .top {
  262. background-color: #FFFFFF;
  263. padding: 30rpx 20rpx;
  264. display: flex;
  265. justify-content: space-between;
  266. align-items: center;
  267. border-bottom: 1rpx solid #EEEEEE;
  268. }
  269. .left {
  270. display: flex;
  271. align-items: center;
  272. }
  273. .car {
  274. font-size: 28rpx;
  275. width: 600rpx;
  276. color: #333333;
  277. line-height: 40rpx;
  278. margin-left: 10rpx;
  279. /* 隐藏文字显示 ...不换行 */
  280. overflow: hidden;
  281. text-overflow: ellipsis;
  282. white-space: nowrap;
  283. }
  284. .brandLogo {
  285. width: 42rpx;
  286. height: 42rpx;
  287. }
  288. .main {
  289. display: flex;
  290. height: calc(100vh - 310rpx);
  291. }
  292. .mainLeft {
  293. width: 154rpx;
  294. background: #F4F5F7;
  295. }
  296. .leftTitle {
  297. color: #333333;
  298. font-size: 26rpx;
  299. }
  300. .lineNum {
  301. position: absolute;
  302. background: #FF270A;
  303. width: 40rpx;
  304. height: 26rpx;
  305. text-align: center;
  306. line-height: 26rpx;
  307. font-size: 20rpx;
  308. color: #FFFFFF;
  309. border-radius: 13rpx;
  310. top: 10rpx;
  311. right: 10rpx;
  312. }
  313. .lineLeftActive {
  314. background: #FFFFFF;
  315. font-weight: bold;
  316. }
  317. .mainRight {
  318. width: 596rpx;
  319. overflow-y: scroll;
  320. background-color: #FFFFFF;
  321. }
  322. .rightTop {
  323. padding: 13rpx 24rpx;
  324. background-color: #F9F9F9;
  325. font-size: 26rpx;
  326. color: #959595;
  327. line-height: 37rpx;
  328. }
  329. .mainRightLine {
  330. padding: 30rpx 0;
  331. margin: 0 24rpx;
  332. background-color: #FFFFFF;
  333. border-bottom: 1rpx solid #EEEEEE;
  334. }
  335. .itemTop {
  336. display: flex;
  337. justify-content: space-between;
  338. align-items: center;
  339. }
  340. .itemName {
  341. font-size: 28rpx;
  342. color: #333333;
  343. }
  344. .rightState {
  345. font-size: 24rpx;
  346. color: #666666;
  347. }
  348. .itemBox {
  349. display: flex;
  350. justify-content: space-around;
  351. /* border-bottom: 1rpx solid #EEEEEE; */
  352. padding-top: 30rpx;
  353. }
  354. .type {
  355. border-radius: 10rpx;
  356. border: 2rpx solid #CCCCCC;
  357. width: 50%;
  358. text-align: center;
  359. }
  360. .marginLeft {
  361. margin-left: 20rpx;
  362. }
  363. .typeName {
  364. height: 57rpx;
  365. color: #666666;
  366. font-size: 26rpx;
  367. line-height: 57rpx;
  368. border-bottom: 2rpx solid #EEEEEE;
  369. }
  370. .orangeLine {
  371. border: 2rpx solid #FF0000;
  372. }
  373. .orangeColor {
  374. color: #FF0000;
  375. }
  376. .renminbi {
  377. font-size: 22rpx;
  378. }
  379. .priceBox{
  380. display: flex;
  381. justify-content: center;
  382. align-items: center;
  383. }
  384. .money {
  385. height: 76rpx;
  386. line-height: 76rpx;
  387. font-size: 32rpx;
  388. color: #FF0000;
  389. }
  390. .old {
  391. color: #999999;
  392. font-size: 24rpx;
  393. text-decoration: line-through;
  394. }
  395. .main {
  396. display: flex;
  397. height: calc(100vh - 410rpx);
  398. }
  399. .mainscrollView {
  400. height: calc(100vh - 410rpx);
  401. padding-bottom: constant(safe-area-inset-bottom);
  402. padding-bottom: env(safe-area-inset-bottom);
  403. box-sizing: content-box;
  404. margin-bottom: 120rpx;
  405. }
  406. /* #ifdef MP-WEIXIN */
  407. .main {
  408. display: flex;
  409. height: calc(100vh - 310rpx);
  410. }
  411. .mainscrollView {
  412. height: calc(100vh - 310rpx);
  413. }
  414. /* #endif */
  415. .mainLeft {
  416. width: 146rpx;
  417. background: #F5F5F5;
  418. }
  419. .mainRight {
  420. width: 604rpx;
  421. }
  422. .mainLeftLine {
  423. color: #3C3C3C;
  424. padding: 30rpx 20rpx;
  425. font-size: 26rpx;
  426. text-align: left;
  427. position: relative;
  428. }
  429. .lineNum {
  430. position: absolute;
  431. background: #FF270A;
  432. width: 40rpx;
  433. height: 26rpx;
  434. text-align: center;
  435. line-height: 26rpx;
  436. font-size: 20rpx;
  437. color: #FFFFFF;
  438. border-radius: 13rpx;
  439. top: 10rpx;
  440. right: 10rpx;
  441. }
  442. .lineLeftActive {
  443. background: #FFFFFF;
  444. }
  445. .nock {
  446. width: 22rpx;
  447. height: 22rpx;
  448. border-radius: 50%;
  449. border: 2px solid #AEAEAE;
  450. margin-top: 2rpx;
  451. margin-right: 10rpx;
  452. }
  453. .imgPrivacy {
  454. width: 36rpx;
  455. height: 36rpx;
  456. /* margin-top: 2rpx; */
  457. /* margin-right: 10rpx; */
  458. }
  459. .contTopRight {
  460. display: flex;
  461. align-items: center;
  462. width: 38rpx;
  463. height: 36rpx;
  464. margin-right: 10rpx;
  465. }
  466. .contTop {
  467. display: flex;
  468. justify-content: space-between;
  469. }
  470. .listPackgeName {
  471. font-size: 26rpx;
  472. font-family: PingFangSC-Regular, PingFang SC;
  473. font-weight: 600;
  474. color: #3C3C3C;
  475. }
  476. .listPackgeMs {
  477. font-size: 22rpx;
  478. font-family: PingFangSC-Regular, PingFang SC;
  479. font-weight: 400;
  480. color: #999999;
  481. padding-top: 5rpx;
  482. line-height: 30rpx;
  483. }
  484. .contZk {
  485. border-bottom: 1px solid #EEEEEE;
  486. padding-bottom: 20rpx;
  487. }
  488. .goodsImg {
  489. width: 120rpx;
  490. height: 120rpx;
  491. border-radius: 11rpx;
  492. }
  493. .goodsItemLIne {
  494. display: flex;
  495. padding-top: 20rpx;
  496. padding-bottom: 20rpx;
  497. }
  498. .goodsCont {
  499. display: flex;
  500. flex-direction: column;
  501. justify-content: space-between;
  502. padding-left: 20rpx;
  503. }
  504. .goodsContTop {
  505. display: flex;
  506. justify-content: space-between;
  507. width: 400rpx;
  508. }
  509. .goodsItemName {
  510. font-size: 26rpx;
  511. font-weight: 400;
  512. color: #3C3C3C;
  513. width: 78%;
  514. }
  515. .salePrice {
  516. font-size: 32rpx;
  517. font-weight: 500;
  518. color: #FF4F00;
  519. }
  520. .replaceBox {
  521. width: 100rpx;
  522. }
  523. .replace {
  524. width: 75rpx;
  525. height: 37rpx;
  526. border-radius: 19rpx;
  527. border: 2rpx solid #B9B9B9;
  528. text-align: center;
  529. line-height: 35rpx;
  530. color: #707070;
  531. font-size: 22rpx;
  532. margin-left: 25rpx;
  533. }
  534. .contZkMain {
  535. padding-top: 20rpx;
  536. }
  537. .asa {
  538. width: 44rpx;
  539. height: 44rpx;
  540. line-height: 44rpx;
  541. text-align: center;
  542. background: #F4F5F7;
  543. font-size: 30rpx;
  544. }
  545. .goodsCOntBOttom {
  546. display: flex;
  547. justify-content: space-between;
  548. }
  549. .as {
  550. display: flex;
  551. }
  552. .goodsPrice {
  553. display: flex;
  554. justify-content: space-between;
  555. padding-top: 10rpx;
  556. }
  557. .goodsPriceNum {
  558. color: #F8F8F8;
  559. font-size: 28rpx;
  560. }
  561. .asNum {
  562. font-size: 24rpx;
  563. color: #333333;
  564. padding: 0 18rpx;
  565. height: 44rpx;
  566. line-height: 44rpx;
  567. background: #F4F5F7;
  568. margin-left: 1px;
  569. margin-right: 1px;
  570. }
  571. .itemNum {
  572. font-size: 24rpx;
  573. font-weight: 400;
  574. color: #999999;
  575. }
  576. .bottom {
  577. position: fixed;
  578. left: 0;
  579. bottom: 0;
  580. width: 100vw;
  581. height: 120rpx;
  582. background: #FFFFFF;
  583. box-shadow: 0px -2px 20px 0px rgba(153, 153, 153, 0.2);
  584. padding-bottom: constant(safe-area-inset-bottom);
  585. padding-bottom: env(safe-area-inset-bottom);
  586. box-sizing: content-box;
  587. z-index: 11;
  588. display: flex;
  589. justify-content: space-between;
  590. }
  591. .caidanImg {
  592. width: 50rpx;
  593. height: 50rpx;
  594. }
  595. .bottomLeft {
  596. display: flex;
  597. }
  598. .caidan {
  599. padding-left: 33rpx;
  600. padding-top: 35rpx;
  601. padding-right: 33rpx;
  602. position: relative;
  603. }
  604. .total {
  605. position: absolute;
  606. width: 40rpx;
  607. height: 26rpx;
  608. background: #FF270A;
  609. line-height: 26rpx;
  610. text-align: center;
  611. color: #FFFFFF;
  612. font-size: 20rpx;
  613. top: 25rpx;
  614. right: 15rpx;
  615. border-radius: 13rpx;
  616. }
  617. .heji1 {
  618. font-size: 24rpx;
  619. font-weight: 500;
  620. color: #666666;
  621. }
  622. .hejiNum {
  623. font-size: 32rpx;
  624. font-family: PingFangSC-Medium, PingFang SC;
  625. font-weight: 500;
  626. color: #FF4F00;
  627. }
  628. .hejiMs {
  629. font-size: 24rpx;
  630. padding-top: 5rpx;
  631. color: #999999;
  632. }
  633. .heji {
  634. padding-top: 23rpx;
  635. }
  636. .settlement {
  637. width: 203rpx;
  638. height: 74rpx;
  639. background: #D53533;
  640. border-radius: 37rpx;
  641. text-align: center;
  642. line-height: 74rpx;
  643. font-size: 30rpx;
  644. font-family: PingFangSC-Medium, PingFang SC;
  645. font-weight: 500;
  646. color: #FEFFFE;
  647. margin-top: 23rpx;
  648. margin-right: 32rpx;
  649. }
  650. .caidanTk {
  651. height: calc(100vh);
  652. width: 100vw;
  653. background: rgba(0, 0, 0, 0.6);
  654. position: fixed;
  655. left: 0;
  656. top: 0;
  657. }
  658. .tkCont {
  659. height: 70vh;
  660. /* margin-top: calc(40vh ); */
  661. position: absolute;
  662. left: 0;
  663. bottom: 0;
  664. }
  665. .caidanTkTop {
  666. width: 750rpx;
  667. height: 90rpx;
  668. background: #FFFFFF;
  669. border-radius: 24rpx 24rpx 0px 0px;
  670. display: flex;
  671. justify-content: space-between;
  672. }
  673. .topTopright {
  674. /* display: flex; */
  675. padding-top: 29rpx;
  676. margin-right: 24rpx;
  677. }
  678. .tkTopTitle {
  679. line-height: 90rpx;
  680. font-size: 30rpx;
  681. font-weight: 600;
  682. color: #3C3C3C;
  683. padding-left: 24rpx;
  684. }
  685. .empty {
  686. width: 86rpx;
  687. height: 42rpx;
  688. background: #EEEEEE;
  689. border-radius: 21rpx;
  690. text-align: center;
  691. color: #666666;
  692. font-size: 24rpx;
  693. line-height: 42rpx;
  694. }
  695. .tkMain {
  696. background: #FFFFFF;
  697. height: calc(70vh - 90rpx);
  698. }
  699. .selectItem {
  700. background-color: #FFFFFFF;
  701. padding: 30rpx 24rpx 0;
  702. display: flex;
  703. justify-content: space-between;
  704. color: #333333;
  705. font-size: 26rpx;
  706. align-items: center;
  707. }
  708. .priceRight {
  709. display: flex;
  710. align-items: center;
  711. }
  712. </style>