paint.vue 17 KB

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