maintain.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161
  1. <template>
  2. <view>
  3. <view class="top">
  4. <view class="topLeft">
  5. <image :src="maintainCarData.brandLogo" mode="aspectFit" class="brandLogo"></image>
  6. <view class="carName">{{maintainCarData.brand}}-{{maintainCarData.series}}</view>
  7. <image src="../../static/img/icon_edit.png" mode="" class="topEdit" @click="carEdit"></image>
  8. </view>
  9. <view class="topRight">
  10. <input type="number" v-model="maintainCarData.milage" @confirm="upMileage" value="" placeholder="请输入当前里程" class="topInput" placeholder-style="color:#ffffff;"/>
  11. <image src="../../static/img/icon_edit.png" mode="" class="topEdit" @click="milageEdit"></image>
  12. </view>
  13. </view>
  14. <!-- 保养推荐 -->
  15. <view class="maintainrecommend">
  16. <view class="recommendTxt">保养推荐</view>
  17. <view class="manual" @click="handbook()">保养手册</view>
  18. </view>
  19. <!--主体 -->
  20. <view class="main">
  21. <view class="mainLeft">
  22. <scroll-view scroll-y="true" class="mainscrollView">
  23. <view class="mainLeftLine" v-for="(item,index) in mealData" :class="{lineLeftActive:leftIndex==index}"
  24. @click="leftClick(item,index)">
  25. <span>{{item.name}}</span>
  26. <view class="lineNum" v-show="item.num!=0">{{item.num}}</view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. <view class="mainRight">
  31. <scroll-view scroll-y="true" class="mainscrollView">
  32. <view v-show="mealData[leftIndex].listPackage.length==0">
  33. <view class="nodataBox">
  34. <image src="../../static/img/nodata.png" mode="widthFix" class="nodataImg"></image>
  35. <view class="noTxt">暂无数据</view>
  36. </view>
  37. </view>
  38. <view class="mainRightLine" v-for="(item,index) in mealData[leftIndex].listPackage">
  39. <view class="contTop">
  40. <view class="contTopLeft">
  41. <view class="listPackgeName"> {{item.name}} </view>
  42. <view class="listPackgeMs">
  43. <span v-if="item.referenceDosageQty">{{item.referenceDosage}}</span>
  44. </view>
  45. </view>
  46. <view class="contTopRight" @click="listcheck(item)">
  47. <image src="../../static/img/login_icon_checked.png" mode="" class="imgPrivacy" v-show="item.planItem"></image>
  48. <image src="../../static/img/login_icon_uncheck.png" mode="" class="imgPrivacy" v-show="!item.planItem"></image>
  49. <!-- <view class="nock" v-show="!item.check"></view> -->
  50. </view>
  51. </view>
  52. <view class="contZk">
  53. <view class="contZkMain" v-show="item.planItem">
  54. <view v-for="(vf,findex) in item.listGoodsAll">
  55. <view class="goodsItemLIne" v-for="(v,i) in vf.goodsList" v-if="i==0" @click="goGoods(v)">
  56. <image :src="v.picUrl" mode="" class="goodsImg" v-if="v.picUrl"></image>
  57. <image src="../../static/img/noimg.png" mode="" class="goodsImg sm" v-else></image>
  58. <view class="goodsCont">
  59. <view class="goodsContTop">
  60. <view class="goodsItemName">{{v.showName}}</view>
  61. <view class="replace" @click.stop="replace(vf,index,findex,i)" v-if="vf.goodsList.length>1">更换</view>
  62. </view>
  63. <view class="goodsCOntBOttom">
  64. <view class="salePrice">¥{{v.salePrice?v.salePrice:'-'}}</view>
  65. <view class="as">
  66. <view class="asa" @click.stop="reduce(v)">-</view>
  67. <view class="asNum">{{v.qty}}</view>
  68. <view class="asa" @click.stop="plus(v)">+</view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="goodsItemLIne" v-for="(v,i) in item.listItem" >
  75. <image :src="v.picUrl" mode="" class="goodsImg" v-if="v.picUrl"></image>
  76. <image src="../../static/img/icon_xiangmu.png" mode="" class="goodsImg sm" v-else></image>
  77. <view class="goodsCont">
  78. <view class="goodsContTop">
  79. <view class="goodsItemName">{{v.itemName}}</view>
  80. </view>
  81. <view class="goodsCOntBOttom">
  82. <view class="salePrice" >¥{{v.salePrice?v.salePrice:'-'}}</view>
  83. <view class="itemNum">x1</view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. <view style="height: 100rpx;"></view>
  91. </scroll-view>
  92. </view>
  93. </view>
  94. <!-- 底部 -->
  95. <view class="bottom">
  96. <view class="bottomLeft">
  97. <view class="caidan" @click="caidanClick">
  98. <image src="../../static/img/caidan.png" mode="" class="caidanImg"></image>
  99. <view class="total" v-show="total>0">{{total}}</view>
  100. </view>
  101. <view>
  102. <view class="heji"> <span class="heji1">合计</span> <span class="hejiNum">¥{{totalhj}}</span> </view>
  103. <view class="hejiMs">商品¥{{goodsTotal}}+工时费¥{{salePriceTotal}}</view>
  104. </view>
  105. </view>
  106. <view class="settlement" @click="settlement">去选店</view>
  107. </view>
  108. <view class="caidanTk" v-show="qingdanShow" @click="qingdanShow=false">
  109. <view class="tkCont">
  110. <view class="caidanTkTop">
  111. <view class="tkTopTitle">清单</view>
  112. <view class="topTopright">
  113. <view class="empty" @click.stop="empty">清空</view>
  114. <view class="close" @click="qingdanShow=false">X</view>
  115. </view>
  116. </view>
  117. <view class="tkMain" @click.stop>
  118. <scroll-view scroll-y="true" class="tkMainSv">
  119. <view class="qingdanLine" v-for="(item,index) in orderData">
  120. <view class="mainTitle">{{item.name}}</view>
  121. <view class="goodsItem" v-for="(v,i) in item.listGoodsAll">
  122. <view >
  123. <image :src="v.picUrl" mode="" class="goodsImg" v-if="v.picUrl"></image>
  124. <image src="../../static/img/noimg.png" mode="" class="goodsImg " v-else></image>
  125. </view>
  126. <view class="goodsItemRight" >
  127. <view class="goodsItemName">{{v.showName}}</view>
  128. <view class="goodsItemBottom">
  129. <view class="goodssalePrice">¥{{v.salePrice?v.salePrice:'-'}}</view>
  130. <view class="goodsNum">x{{v.qty}}</view>
  131. </view>
  132. </view>
  133. </view>
  134. <view class="goodsItem" v-for="(v,i) in item.listItem">
  135. <view>
  136. <image :src="v.picUrl" mode="" class="goodsImg" v-if="v.picUrl"></image>
  137. <image src="../../static/img/icon_xiangmu.png" mode="" class="goodsImg " v-else></image>
  138. </view>
  139. <view class="goodsItemRight" >
  140. <view class="goodsItemName">{{v.itemName}}</view>
  141. <view class="goodsItemBottom">
  142. <view class="goodssalePrice">¥{{v.salePrice?v.salePrice:'-'}}</view>
  143. <view class="goodsNum">x{{v.qty}}</view>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. <view class="ckBottom"></view>
  149. </scroll-view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. </template>
  155. <script>
  156. export default {
  157. data() {
  158. return {
  159. maintainCarData:'',
  160. shopData:'',
  161. mealData:'',
  162. leftIndex:0,
  163. total:0,
  164. qingdanShow:false,
  165. totalhj:0,
  166. goodsTotal:0,
  167. salePriceTotal:0,
  168. orderData:[],
  169. replaceIndex1:'',
  170. replaceIndex2:'',
  171. brand:'',
  172. isNull:true,
  173. }
  174. },
  175. onLoad(opt) {
  176. this.$common.isUserId()
  177. this.maintainCarData=uni.getStorageSync("maintainCarData");
  178. //console.log(this.maintainCarData)
  179. this.shopData=uni.getStorageSync("shopData");
  180. if(this.maintainCarData.milage==0){
  181. this.maintainCarData.milage='';
  182. }
  183. if (opt.brand) {
  184. this.brand = opt.brand
  185. }
  186. this.getData();
  187. },
  188. onShow() {
  189. var maintainCarData2=uni.getStorageSync("maintainCarData");
  190. if(this.maintainCarData.id!=maintainCarData2.id){
  191. this.maintainCarData=maintainCarData2;
  192. if(this.maintainCarData.milage==0){
  193. this.maintainCarData.milage='';
  194. }
  195. this.getData();
  196. }
  197. var replaceData=uni.getStorageSync("replaceData");
  198. if(replaceData){
  199. //replaceData.qty=1;
  200. console.log(replaceData)
  201. //console.log(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll.goodsList[this.replaceIndex2])
  202. this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList.unshift(replaceData)
  203. //console.log(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll.goodsList[this.replaceIndex2])
  204. this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList=this.unique(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList)
  205. //this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2]=replaceData
  206. //this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsName='666'
  207. //console.log(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2])
  208. this.$forceUpdate()
  209. this.calculation()
  210. }
  211. },
  212. methods: {
  213. unique(arr1) {
  214. const res = new Map();
  215. return arr1.filter((a) => !res.has(a.goodsID) && res.set(a.goodsID, 1))
  216. },
  217. upMileage(){
  218. this.getData();
  219. this.$http('worldKeepCar/worldHome/updateTMemberCarByHome', {
  220. id: this.maintainCarData.id,
  221. milage: this.maintainCarData.milage?this.maintainCarData.milage:0,
  222. }, 'POST').then(res => {
  223. uni.hideLoading();
  224. console.log(res);
  225. if (res.code == 0) {
  226. var cardata = uni.getStorageSync("maintainCarData")
  227. if (cardata) {
  228. cardata.milage = this.maintainCarData.milage
  229. uni.setStorage({
  230. key: 'maintainCarData',
  231. data: cardata,
  232. success: function () {
  233. }
  234. });
  235. }
  236. }
  237. })
  238. },
  239. // milageEditconfirm(){
  240. // this.getData();
  241. // var that=this;
  242. // for(let k in this.maintainCarData){this.maintainCarData[k] = this.maintainCarData[k]==null?'':this.maintainCarData[k]}
  243. // this.$http('miniAppMyBMemberCar/updateMemberCar',this.maintainCarData,'POST').then(res => {
  244. // uni.hideLoading();
  245. // uni.setStorage({
  246. // key: 'maintainCarData',
  247. // data: that.maintainCarData,
  248. // success: function () {
  249. // /* uni.navigateBack({
  250. // delta:1
  251. // }) */
  252. // }
  253. // });
  254. // })
  255. // },
  256. leftClick(item,index){
  257. this.leftIndex=index
  258. },
  259. listcheck(item){
  260. item.planItem=!item.planItem;
  261. //var
  262. if(this.mealData[this.leftIndex].name=='小保养'){
  263. this.calculation('大保养');
  264. }else if(this.mealData[this.leftIndex].name=='大保养'){
  265. this.calculation('小保养');
  266. }else{
  267. this.calculation();
  268. }
  269. if(item.planItem){
  270. /* this.orderData.push(item) */
  271. }
  272. },
  273. goGoods(item){
  274. uni.navigateTo({
  275. url:'../module/goodsDetail?goodsId='+item.goodsID+'&type=1'+'&typeIndex=2&maintain=1'
  276. })
  277. },
  278. empty(){
  279. var that=this;
  280. uni.showModal({
  281. title: '提示',
  282. content: '确定要清空清单吗',
  283. success: function (res) {
  284. if (res.confirm) {
  285. that.orderData=[];
  286. that.mealData.forEach(item=>{
  287. item.num=0;
  288. if(item.listPackage){
  289. item.listPackage.forEach(v=>{
  290. v.planItem=false
  291. })
  292. }
  293. })
  294. console.log(that.mealData)
  295. that.calculation();
  296. that.qingdanShow=false;
  297. }
  298. }
  299. });
  300. },
  301. calculation(txt){
  302. this.isNull=true
  303. this.total=0;
  304. this.totalhj=0;
  305. this.goodsTotal=0;
  306. this.salePriceTotal=0;
  307. this.orderData=[]
  308. this.mealData.forEach(v=>{
  309. v.num=0;
  310. if(txt == v.name){
  311. console.log(v.name)
  312. if(v.listPackage){
  313. v.listPackage.forEach(i=>{
  314. i.planItem=false
  315. })
  316. }
  317. }else{
  318. if(v.listPackage){
  319. v.listPackage.forEach(i=>{
  320. if(i.planItem){
  321. var obj={
  322. listGoodsAll:[],
  323. listItem:'',
  324. id:i.id,
  325. name:i.name
  326. }
  327. if(i.listGoodsAll.length>0){
  328. i.listGoodsAll.forEach((goods,goodsIndex)=>{
  329. console.log(goods.goodsGroupDetail)
  330. /* goods.forEach(sp=>{
  331. this.goodsTotal=Number(this.goodsTotal)
  332. this.goodsTotal+=sp.salePrice*sp.qty
  333. this.goodsTotal=this.goodsTotal.toFixed(2)
  334. })
  335. //goods[0].salePrice=1;*/
  336. this.goodsTotal=Number(this.goodsTotal)
  337. if(!isNaN(goods.goodsList[0].salePrice)){
  338. this.goodsTotal+=goods.goodsList[0].salePrice*goods.goodsList[0].qty
  339. this.goodsTotal=this.goodsTotal.toFixed(2)
  340. }else{
  341. this.isNull=false
  342. }
  343. if(goods.goodsList[0].salePrice==null){
  344. this.isNull=false
  345. }
  346. obj.listGoodsAll.push(goods.goodsList[0])
  347. })
  348. }
  349. if(i.listItem.length>0){
  350. obj.listItem=i.listItem
  351. }
  352. this.orderData.push(obj)
  353. v.num++;
  354. this.total++;
  355. i.listItem.forEach(xm=>{
  356. xm.qty=1;
  357. if(!isNaN(xm.salePrice)){
  358. this.salePriceTotal=Number(this.salePriceTotal)
  359. this.salePriceTotal+=xm.salePrice
  360. this.salePriceTotal=this.salePriceTotal.toFixed(2)
  361. }else{
  362. this.isNull=false
  363. }
  364. if(xm.salePrice==null){
  365. this.isNull=false
  366. }
  367. //xm.salePrice=1;
  368. })
  369. //this.totalhj
  370. }
  371. })
  372. }
  373. }
  374. //if(v.listPackage)
  375. })
  376. this.totalhj=Number(this.goodsTotal)+Number(this.salePriceTotal)
  377. this.totalhj=this.totalhj.toFixed(2)
  378. console.log(this.orderData)
  379. },
  380. reduce(v){
  381. console.log(v)
  382. if(v.qty>1){
  383. v.qty--;
  384. this.calculation()
  385. }else if(v.del){
  386. if(v.qty>0){
  387. v.qty--;
  388. this.calculation()
  389. }
  390. }
  391. },
  392. plus(v){
  393. v.qty++;
  394. this.calculation()
  395. },
  396. getData(){
  397. uni.showLoading({
  398. title: '加载中'
  399. })
  400. var location = uni.getStorageSync("locationCity");
  401. var selectCity = uni.getStorageSync("selectCity");
  402. var cityCode=''
  403. if(selectCity){
  404. cityCode=selectCity.code
  405. }else{
  406. cityCode=location.cityCode
  407. }
  408. this.$http('miniApp/tPackageMiniAppController/queryPackageList', {
  409. mileage:this.maintainCarData.milage,
  410. liyangId:this.maintainCarData.nLevelID,
  411. cityCode:cityCode,
  412. guidePrice:this.maintainCarData.guidePrice?this.maintainCarData.guidePrice:0,
  413. },'GET').then(res => {
  414. console.log(res)
  415. uni.hideLoading();
  416. if(res.code==1){
  417. uni.showModal({
  418. title: '提示',
  419. content: res.msg,
  420. showCancel:false,
  421. success: function (res) {
  422. }
  423. });
  424. }
  425. res.data.forEach(item=>{
  426. //console.log(item)
  427. item.listPackage.forEach((list,i)=>{
  428. if(list.listGoodsAll.length>0){
  429. list.listGoodsAll.forEach((goods,index)=>{
  430. //console.log(goods.goodsGroupDetail)
  431. if(goods.goodsGroupDetail.length==0){
  432. //同组品为空的情况
  433. if(goods.goodsList[0].capacity&&!goods.goodsList[0].del){
  434. //console.log(Number(list.referenceDosageQty)/goods[0].capacity)
  435. if(Number(list.referenceDosageQty)/goods.goodsList[0].capacity>1){
  436. var qtynum1=Number(list.referenceDosageQty)-goods.goodsList[0].capacity
  437. var qtynum2=Math.ceil(qtynum1/goods.goodsList[0].capacity)
  438. goods.goodsList.splice(300);
  439. var addArrnt=JSON.parse(JSON.stringify(goods.goodsList))
  440. //console.log(addArrnt[0])
  441. addArrnt[0].qty=qtynum2
  442. var addDta={
  443. goodsGroupDetail:[],
  444. goodsList:addArrnt
  445. }
  446. addDta.goodsList.forEach(add=>{
  447. add.del=true;
  448. })
  449. //addDta.splice(1,0)
  450. console.log(addDta)
  451. var add=JSON.parse(JSON.stringify(addDta))
  452. list.listGoodsAll.splice(index+1, 0,add)
  453. }
  454. }
  455. }else{
  456. //同组品不为空的情况
  457. //console.log("同组品不为空的情况 ")
  458. var remainder=0;
  459. var addNum=index
  460. console.log("list.referenceDosageQty - "+list.referenceDosageQty+list.name)
  461. var referenceDosageQty=Number(list.referenceDosageQty)
  462. //var addArr= goods.goodsList
  463. goods.goodsList.splice(300);
  464. if(list.referenceDosageQty&&!goods.goodsList[0].del){
  465. goods.goodsGroupDetail.forEach((tgoods,tindex)=>{
  466. var addArr=JSON.parse(JSON.stringify(goods.goodsList))
  467. if(tindex==0){
  468. if(tgoods.capacity){
  469. if(referenceDosageQty>tgoods.capacity){
  470. //console.log("referenceDosageQty>tgoods.capacity")
  471. var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
  472. //console.log("parseIntNum--"+parseIntNum)
  473. tgoods.qty=parseIntNum
  474. addArr.unshift(tgoods)
  475. var reduce= tgoods.capacity*parseIntNum
  476. referenceDosageQty=referenceDosageQty - reduce
  477. var addDta={
  478. goodsGroupDetail:[],
  479. goodsList:addArr,
  480. del:true,
  481. }
  482. addDta.goodsList.forEach(add=>{
  483. add.del=true;
  484. })
  485. list.listGoodsAll.splice(index, 1,addDta)
  486. }else{
  487. console.log("推荐大于容量")
  488. if(goods.goodsGroupDetail.length==1){
  489. console.log("同组品 一个")
  490. addArr.unshift(tgoods)
  491. referenceDosageQty=referenceDosageQty-tgoods.capacity
  492. var addDta={
  493. goodsGroupDetail:[],
  494. goodsList:addArr,
  495. del:true,
  496. }
  497. addDta.goodsList.forEach(add=>{
  498. add.del=true;
  499. })
  500. list.listGoodsAll.splice(index, 1,addDta)
  501. }else{
  502. list.listGoodsAll.splice(index, 1)
  503. }
  504. }
  505. }else{
  506. addArr.unshift(tgoods)
  507. var addDta={
  508. goodsGroupDetail:[],
  509. goodsList:addArr,
  510. del:true,
  511. }
  512. addDta.goodsList.forEach(add=>{
  513. add.del=true;
  514. })
  515. list.listGoodsAll.splice(index, 1,addDta)
  516. }
  517. }else{
  518. if(goods.goodsGroupDetail[0].capacity){
  519. if(referenceDosageQty>0){
  520. console.log('referenceDosageQty'+referenceDosageQty)
  521. console.log(tgoods)
  522. /* remainder=Number(referenceDosageQty)%tgoods.capacity
  523. if(remainder>1){
  524. addArr.unshift(tgoods)
  525. }
  526. referenceDosageQty=referenceDosageQty-tgoods.capacity */
  527. if(referenceDosageQty>tgoods.capacity){
  528. var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
  529. var reduce= tgoods.capacity*parseIntNum
  530. if(goods.goodsGroupDetail.length==tindex+1){
  531. var a=referenceDosageQty - reduce
  532. if(a>0){
  533. parseIntNum++
  534. }
  535. }
  536. tgoods.qty=parseIntNum
  537. addArr.unshift(tgoods)
  538. referenceDosageQty=referenceDosageQty - reduce
  539. var addDta={
  540. goodsGroupDetail:[],
  541. goodsList:addArr,
  542. del:true
  543. }
  544. addDta.goodsList.forEach(add=>{
  545. add.del=true;
  546. })
  547. //console.log(addArr)
  548. if(tindex==0){
  549. // console.log(addDta.goodsList[0])
  550. //list.listGoodsAll.splice(index, 1,addDta)
  551. //console.log(list.listGoodsAll[index])
  552. }else{
  553. addNum++
  554. console.log('addNum=='+addNum)
  555. //console.log(addDta.goodsList[0])
  556. list.listGoodsAll.splice(addNum, 0,addDta)
  557. }
  558. }else{
  559. if(goods.goodsGroupDetail.length==tindex+1){
  560. addArr.unshift(tgoods)
  561. referenceDosageQty=referenceDosageQty-tgoods.capacity
  562. var addDta={
  563. goodsGroupDetail:[],
  564. goodsList:addArr,
  565. del:true
  566. }
  567. addDta.goodsList.forEach(add=>{
  568. add.del=true;
  569. })
  570. //console.log(addArr)
  571. if(tindex==0){
  572. // console.log(addDta.goodsList[0])
  573. //list.listGoodsAll.splice(index, 1,addDta)
  574. //console.log(list.listGoodsAll[index])
  575. }else{
  576. addNum++
  577. console.log('addNum=='+addNum)
  578. //console.log(addDta.goodsList[0])
  579. list.listGoodsAll.splice(addNum, 0,addDta)
  580. }
  581. }
  582. }
  583. }
  584. }
  585. }
  586. } )
  587. }
  588. }
  589. })
  590. }
  591. })
  592. })
  593. this.mealData=res.data;
  594. this.mealData.splice(1,0)
  595. console.log(this.mealData)
  596. this.calculation();
  597. })
  598. },
  599. handbook(){
  600. uni.navigateTo({
  601. url:'handbook?mileage'+this.maintainCarData.milage+'&liyangId='+this.maintainCarData.nLevelID
  602. })
  603. },
  604. settlement(){
  605. if(!this.isNull){
  606. uni.showToast({
  607. title: '您选择的有未设置价格的商品,请重新选择',
  608. icon:'none',
  609. duration: 5000
  610. });
  611. return false;
  612. }
  613. console.log(this.orderData)
  614. //return false;
  615. uni.removeStorageSync('couponData');
  616. if(this.orderData.length>0){
  617. /* uni.navigateTo({
  618. url:'confirmOrder?orderData='+JSON.stringify(this.orderData)+'&currentMileage='+this.maintainCarData.milage
  619. }) */
  620. uni.navigateTo({
  621. url:'orderShop?orderData='+JSON.stringify(this.orderData)+'&currentMileage='+this.maintainCarData.milage+'&brand='+this.brand
  622. })
  623. }
  624. },
  625. replace(v,index,i,replaceIndex){
  626. //v.splice(replaceIndex, 1)
  627. console.log(v)
  628. console.log(replaceIndex)
  629. v.goodsList.forEach((item,vindex)=>{
  630. if(replaceIndex==vindex){
  631. item.showr=false
  632. }else{
  633. item.showr=true
  634. }
  635. })
  636. uni.removeStorageSync('replaceData');
  637. this.replaceIndex1=index;
  638. this.replaceIndex2=i;
  639. uni.setStorage({
  640. key: 'replaceDataList',
  641. data: v,
  642. success: function () {
  643. uni.navigateTo({
  644. url:'replaceGoods'
  645. })
  646. }
  647. });
  648. },
  649. caidanClick(){
  650. this.qingdanShow=!this.qingdanShow
  651. },
  652. milageEdit(){
  653. this.maintainCarData.milage=''
  654. },
  655. carEdit(){
  656. uni.navigateTo({
  657. url:'../index/cailist?type=2'
  658. })
  659. }
  660. }
  661. }
  662. </script>
  663. <style scoped>
  664. .caidanTk{
  665. height: calc(100vh );
  666. width: 100vw;
  667. background: rgba(0,0,0,0.6);
  668. position:fixed;
  669. left: 0;
  670. top: 0;
  671. }
  672. .tkCont{
  673. height: 70vh;
  674. /* margin-top: calc(40vh ); */
  675. position: absolute;
  676. left: 0;
  677. bottom: 0;
  678. }
  679. .caidanTkTop{
  680. width: 750rpx;
  681. height: 90rpx;
  682. background: #FFFFFF;
  683. border-radius: 24rpx 24rpx 0px 0px;
  684. }
  685. .caidanTkTop{
  686. display: flex;justify-content: space-between;
  687. }
  688. .topTopright{
  689. display: flex;
  690. padding-top: 29rpx;
  691. }
  692. .tkTopTitle{
  693. line-height: 90rpx;
  694. font-size: 30rpx;
  695. font-weight: 600;
  696. color: #3C3C3C;
  697. padding-left: 24rpx;
  698. }
  699. .empty{
  700. width: 86rpx;
  701. height: 42rpx;
  702. background: #EEEEEE;
  703. border-radius: 21rpx;
  704. text-align: center;
  705. color: #666666;
  706. font-size: 24rpx;
  707. line-height: 42rpx;
  708. }
  709. .close{
  710. color: #999999;
  711. font-size: 30rpx;
  712. padding-right: 30rpx;
  713. padding-left: 24rpx;
  714. }
  715. .tkMain{
  716. background: #F0F0F0;
  717. height: calc(70vh - 90rpx);
  718. }
  719. .tkMainSv{
  720. padding: 0 24rpx;
  721. width: 702rpx;
  722. height: calc(70vh - 150rpx);
  723. }
  724. .goodsItemRight{
  725. width: 520rpx;
  726. padding-left: 20rpx;
  727. display: flex;
  728. flex-direction:column;
  729. justify-content: space-between;
  730. }
  731. .goodsItemBottom{
  732. display: flex;
  733. justify-content: space-between;
  734. }
  735. .goodssalePrice{
  736. font-size: 32rpx;font-weight: 500;color: #FF4F00;
  737. }
  738. .goodsNum{
  739. font-size: 24rpx;font-weight: 400;color: #999999;
  740. }
  741. .top{
  742. background: #FF4F00;
  743. display: flex;
  744. justify-content: space-between;
  745. padding: 30rpx 25rpx;
  746. font-size: 28rpx;
  747. color: #FFFFFF;
  748. }
  749. .goodsItem{
  750. display: flex;
  751. padding: 15rpx 0;
  752. }
  753. .qingdanLine{
  754. background: #FFFFFF;
  755. margin-top: 20rpx;
  756. padding: 24rpx 20rpx;
  757. border-radius: 10rpx;
  758. }
  759. .brandLogo{
  760. width: 42rpx;
  761. height: 42rpx;
  762. padding: 0 10rpx;
  763. }
  764. .topLeft{
  765. display: flex;
  766. align-content: center;
  767. }
  768. .carName{
  769. width: 61%;
  770. }
  771. .topEdit{
  772. width: 22rpx;
  773. height: 22rpx;
  774. padding: 10rpx;
  775. }
  776. .topRight{
  777. display: flex;
  778. justify-content: flex-end;
  779. align-items: center;
  780. }
  781. .topInput{
  782. font-size: 28rpx;
  783. color: #FFFFFF;
  784. text-align: right;
  785. padding-top: 3rpx;
  786. width: 70%;
  787. }
  788. .maintainrecommend{
  789. padding: 30rpx 24rpx;
  790. display: flex;
  791. justify-content: space-between;
  792. border-bottom: 2rpx solid #EEEEEE;
  793. }
  794. .recommendTxt{
  795. color: #3C3C3C;
  796. font-size: 30rpx;
  797. font-weight: 600;
  798. }
  799. .manual{
  800. width: 119rpx;
  801. height: 40rpx;
  802. border-radius: 20rpx;
  803. border: 2rpx solid #F19D01;
  804. text-align: center;
  805. line-height: 40rpx;
  806. font-size: 22rpx;
  807. color: #F19D01;
  808. }
  809. .bottom{
  810. position: fixed;
  811. left: 0;
  812. bottom: 0;
  813. width: 100vw;
  814. height: 120rpx;
  815. background: #FFFFFF;
  816. box-shadow: 0px -2px 20px 0px rgba(153, 153, 153, 0.2);
  817. padding-bottom: constant(safe-area-inset-bottom);
  818. padding-bottom: env(safe-area-inset-bottom);
  819. box-sizing: content-box;
  820. z-index: 11;
  821. }
  822. .ckBottom{
  823. width: 100vw;
  824. height: 120rpx;
  825. padding-bottom: constant(safe-area-inset-bottom);
  826. padding-bottom: env(safe-area-inset-bottom);
  827. box-sizing: content-box;
  828. }
  829. .main{
  830. display: flex;
  831. height: calc(100vh - 410rpx);
  832. }
  833. .mainscrollView{
  834. height: calc(100vh - 410rpx);
  835. padding-bottom: constant(safe-area-inset-bottom);
  836. padding-bottom: env(safe-area-inset-bottom);
  837. box-sizing: content-box;
  838. margin-bottom: 120rpx;
  839. }
  840. /* #ifdef MP-WEIXIN */
  841. .main{
  842. display: flex;
  843. height: calc(100vh - 310rpx);
  844. }
  845. .mainscrollView{
  846. height: calc(100vh - 310rpx);
  847. }
  848. /* #endif */
  849. .mainLeft{
  850. width: 146rpx;
  851. background: #F5F5F5;
  852. }
  853. .mainRight{
  854. width: 604rpx;
  855. }
  856. .mainLeftLine{
  857. color: #3C3C3C;
  858. padding: 30rpx 20rpx;
  859. font-size: 24rpx;
  860. text-align: center;
  861. position: relative;
  862. }
  863. .lineNum{
  864. position: absolute;
  865. background: #FF270A;
  866. width: 40rpx;
  867. height: 26rpx;
  868. text-align: center;
  869. line-height: 26rpx;
  870. font-size: 20rpx;
  871. color: #FFFFFF;
  872. border-radius: 13rpx;
  873. top: 10rpx;
  874. right: 10rpx;
  875. }
  876. .lineLeftActive{
  877. background: #FFFFFF;
  878. }
  879. .nock{
  880. width: 22rpx;
  881. height: 22rpx;
  882. border-radius: 50%;
  883. border:2px solid #AEAEAE;
  884. margin-top: 2rpx;
  885. margin-right: 10rpx;
  886. }
  887. .imgPrivacy{
  888. width: 36rpx;
  889. height: 36rpx;
  890. /* margin-top: 2rpx; */
  891. /* margin-right: 10rpx; */
  892. }
  893. .contTopRight{
  894. display: flex;
  895. align-items: center;
  896. width: 38rpx;
  897. height: 36rpx;
  898. margin-right: 10rpx;
  899. }
  900. .mainRightLine{
  901. padding: 20rpx 20rpx 0 20rpx;
  902. }
  903. .contTop{
  904. display: flex;
  905. justify-content: space-between;
  906. }
  907. .listPackgeName{
  908. font-size: 26rpx;
  909. font-family: PingFangSC-Regular, PingFang SC;
  910. font-weight: 600;
  911. color: #3C3C3C;
  912. }
  913. .listPackgeMs{
  914. font-size: 22rpx;
  915. font-family: PingFangSC-Regular, PingFang SC;
  916. font-weight: 400;
  917. color: #999999;
  918. padding-top: 5rpx;
  919. line-height: 30rpx;
  920. }
  921. .contZk{
  922. border-bottom: 1px solid #EEEEEE;
  923. padding-bottom: 20rpx;
  924. }
  925. .goodsImg{
  926. width: 120rpx;
  927. height: 120rpx;
  928. border-radius: 11rpx;
  929. }
  930. .goodsItemLIne{
  931. display: flex;
  932. padding-top: 20rpx;
  933. padding-bottom: 20rpx;
  934. }
  935. .goodsCont{
  936. display: flex;
  937. flex-direction:column;
  938. justify-content: space-between;
  939. padding-left: 20rpx;
  940. }
  941. .goodsContTop{
  942. display: flex;
  943. justify-content: space-between;
  944. width: 400rpx;
  945. }
  946. .goodsItemName{
  947. font-size: 26rpx;
  948. font-weight: 400;
  949. color: #3C3C3C;
  950. width: 78%;
  951. }
  952. .salePrice{
  953. font-size: 32rpx;
  954. font-weight: 500;
  955. color: #FF4F00;
  956. }
  957. .replace{
  958. width: 75rpx;
  959. height: 37rpx;
  960. border-radius: 19rpx;
  961. border: 2rpx solid #B9B9B9;
  962. text-align: center;
  963. line-height: 35rpx;
  964. color: #707070;
  965. font-size: 22rpx;
  966. }
  967. .contZkMain{
  968. padding-top: 20rpx;
  969. }
  970. .asa{
  971. width: 44rpx;
  972. height: 44rpx;
  973. line-height: 44rpx;
  974. text-align: center;
  975. background: #F4F5F7;
  976. font-size: 30rpx;
  977. }
  978. .goodsCOntBOttom{
  979. display: flex;
  980. justify-content: space-between;
  981. }
  982. .as{
  983. display: flex;
  984. }
  985. .goodsPrice{
  986. display: flex;justify-content: space-between;
  987. padding-top: 10rpx;
  988. }
  989. .goodsPriceNum{
  990. color: #F8F8F8;
  991. font-size: 28rpx;
  992. }
  993. .asNum{
  994. font-size: 24rpx;color: #333333;
  995. padding: 0 18rpx;
  996. height: 44rpx;
  997. line-height: 44rpx;
  998. background: #F4F5F7;
  999. margin-left: 1px;
  1000. margin-right: 1px;
  1001. }
  1002. .itemNum{
  1003. font-size: 24rpx;
  1004. font-weight: 400;
  1005. color: #999999;
  1006. }
  1007. .bottom{
  1008. display: flex;
  1009. justify-content: space-between;
  1010. }
  1011. .caidanImg{
  1012. width: 50rpx;
  1013. height: 50rpx;
  1014. }
  1015. .bottomLeft{
  1016. display: flex;
  1017. }
  1018. .caidan{
  1019. padding-left: 33rpx;
  1020. padding-top: 35rpx;
  1021. padding-right: 33rpx;
  1022. position: relative;
  1023. }
  1024. .total{
  1025. position: absolute;
  1026. width: 40rpx;
  1027. height: 26rpx;
  1028. background: #FF270A;
  1029. line-height: 26rpx;
  1030. text-align: center;
  1031. color: #FFFFFF;
  1032. font-size: 20rpx;
  1033. top: 25rpx;
  1034. right: 15rpx;
  1035. border-radius: 13rpx;
  1036. }
  1037. .heji1{
  1038. font-size: 24rpx;
  1039. font-weight: 500;
  1040. color: #666666;
  1041. }
  1042. .hejiNum{
  1043. font-size: 32rpx;
  1044. font-family: PingFangSC-Medium, PingFang SC;
  1045. font-weight: 500;
  1046. color: #FF4F00;
  1047. }
  1048. .hejiMs{
  1049. font-size: 24rpx;
  1050. padding-top: 5rpx;
  1051. color: #999999;
  1052. }
  1053. .heji{
  1054. padding-top: 23rpx;
  1055. }
  1056. .settlement{
  1057. width: 203rpx;
  1058. height: 74rpx;
  1059. background: #FF4F00;
  1060. border-radius: 37rpx;
  1061. text-align: center;
  1062. line-height: 74rpx;
  1063. font-size: 30rpx;
  1064. font-family: PingFangSC-Medium, PingFang SC;
  1065. font-weight: 500;
  1066. color: #FEFFFE;
  1067. margin-top: 23rpx;
  1068. margin-right: 32rpx;
  1069. }
  1070. .nodataImg{
  1071. width: 400rpx;
  1072. padding-top: 100rpx;
  1073. }
  1074. .noTxt{
  1075. font-size: 36rpx;
  1076. color: #999999;
  1077. padding-top: 50rpx;
  1078. }
  1079. .nodataBox{
  1080. text-align: center;
  1081. }
  1082. </style>