paint.vue 15 KB

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