paint.vue 16 KB

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