maintain.vue 30 KB

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