paint.vue 16 KB

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