作者 lihongjuan

1

@@ -772,7 +772,13 @@ @@ -772,7 +772,13 @@
772 line-height: 88rpx; 772 line-height: 88rpx;
773 border-radius: 10rpx; 773 border-radius: 10rpx;
774 } 774 }
775 - 775 +.behuiyuanbtn{
  776 + width:486rpx;
  777 +}
  778 +.surezhifu{
  779 + color:#C29445;
  780 + font-size: 32rpx;
  781 +}
776 /* 优惠券使用规则 */ 782 /* 优惠券使用规则 */
777 .couponrule { 783 .couponrule {
778 width: 540rpx; 784 width: 540rpx;
1 <template> 1 <template>
2 <view class="content"> 2 <view class="content">
3 - <view class="editcart" @click="editcart">{{editsel==true?'编辑':'完成'}}</view> 3 + <view class="editcart" @click="editcart">{{editsel==true?'编辑':'完成'}}</view>
4 <!-- <view class="editcart" @click="finishedit" v-else>完成</view> --> 4 <!-- <view class="editcart" @click="finishedit" v-else>完成</view> -->
5 - 5 +
6 <view class="sureshop"> 6 <view class="sureshop">
7 <!-- 店铺商品--> 7 <!-- 店铺商品-->
8 <view v-if="data1.length!=0"> 8 <view v-if="data1.length!=0">
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 <view class='cartlist'> 52 <view class='cartlist'>
53 <view class="sureorderitem flexone" v-for="(item,index) in data2" :key="index"> 53 <view class="sureorderitem flexone" v-for="(item,index) in data2" :key="index">
54 <view class="cartselimg" @click="selectcart(item,index)"> 54 <view class="cartselimg" @click="selectcart(item,index)">
55 - 55 +
56 <image src="../../static/cartnosel.png" mode="" v-if="item.sel==false"></image> 56 <image src="../../static/cartnosel.png" mode="" v-if="item.sel==false"></image>
57 <image src="../../static/cartsel.png" mode="" v-else></image> 57 <image src="../../static/cartsel.png" mode="" v-else></image>
58 </view> 58 </view>
@@ -61,13 +61,13 @@ @@ -61,13 +61,13 @@
61 </view> 61 </view>
62 <view class='shuright'> 62 <view class='shuright'>
63 <view class="suregoodnamek"> 63 <view class="suregoodnamek">
64 - {{item.flour_goods.name}} 64 + {{item.flour_goods.name}}
65 </view> 65 </view>
66 <!-- 商品属性 --> 66 <!-- 商品属性 -->
67 <view v-if="item.flour_goods.spec.length!=0"> 67 <view v-if="item.flour_goods.spec.length!=0">
68 <view class="spec" v-for="(item,index) in item.flour_goods.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view> 68 <view class="spec" v-for="(item,index) in item.flour_goods.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view>
69 </view> 69 </view>
70 - 70 +
71 <view class="surebot flextwo"> 71 <view class="surebot flextwo">
72 <view class="saleprice">¥{{item.flour_goods.price}}</view> 72 <view class="saleprice">¥{{item.flour_goods.price}}</view>
73 <view class="weightnumk flexone"> 73 <view class="weightnumk flexone">
@@ -112,7 +112,7 @@ @@ -112,7 +112,7 @@
112 <view v-if="item.score_goods.spec.length!=0"> 112 <view v-if="item.score_goods.spec.length!=0">
113 <view class="spec" v-for="(item,index) in item.score_goods.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view> 113 <view class="spec" v-for="(item,index) in item.score_goods.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view>
114 </view> 114 </view>
115 - 115 +
116 <view class="surebot flextwo"> 116 <view class="surebot flextwo">
117 <view class="saleprice">¥{{item.score_goods.price}}</view> 117 <view class="saleprice">¥{{item.score_goods.price}}</view>
118 <view class="weightnumk flexone"> 118 <view class="weightnumk flexone">
@@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@
140 </view> 140 </view>
141 <view class='jiesuan' @click="jiesuan">去结算({{arr.length}}件)</view> 141 <view class='jiesuan' @click="jiesuan">去结算({{arr.length}}件)</view>
142 </view> 142 </view>
143 - 143 +
144 <view class="cartbottom flextwo" v-else> 144 <view class="cartbottom flextwo" v-else>
145 <view class="flexone"> 145 <view class="flexone">
146 <view class="cartselimg" @click="selshan"> 146 <view class="cartselimg" @click="selshan">
@@ -149,7 +149,7 @@ @@ -149,7 +149,7 @@
149 </view> 149 </view>
150 <view class="quanname">全选</view> 150 <view class="quanname">全选</view>
151 </view> 151 </view>
152 - 152 +
153 <view class="delgoodname" @click="delgood">删除商品</view> 153 <view class="delgoodname" @click="delgood">删除商品</view>
154 </view> 154 </view>
155 </view> 155 </view>
@@ -165,11 +165,11 @@ @@ -165,11 +165,11 @@
165 data3: [], //积分商品 165 data3: [], //积分商品
166 selall: false, 166 selall: false,
167 total: 0, 167 total: 0,
168 - arr:[],  
169 - data:[],  
170 - seldelall:false,  
171 - cartid:[],  
172 - editsel:true 168 + arr: [],
  169 + data: [],
  170 + seldelall: false,
  171 + cartid: [],
  172 + editsel: true
173 } 173 }
174 }, 174 },
175 onLoad() { 175 onLoad() {
@@ -178,84 +178,126 @@ @@ -178,84 +178,126 @@
178 console.log(uni.getStorageSync("token")) 178 console.log(uni.getStorageSync("token"))
179 }, 179 },
180 methods: { 180 methods: {
181 - editcart(){  
182 - this.editsel=!this.editsel;  
183 - 181 + editcart() {
  182 + this.editsel = !this.editsel;
  183 + this.cartid = [];
  184 + this.arr = [],
  185 + this.data = [],
  186 + this.seldelall = false;
  187 + this.selall = false;
  188 + this.getcartlist()
184 }, 189 },
185 - 190 +
186 // 删除商品 191 // 删除商品
187 - selshan(){  
188 - let that=this;  
189 - this.seldelall=!this.seldelall;  
190 - if(this.seldelall==true){  
191 - this.data3.forEach(function(value, index, array) { 192 + selshan() {
  193 + let that = this;
  194 + let newcartid = [];
  195 + this.seldelall = !this.seldelall;
  196 + if (this.seldelall == true) {
  197 + this.data3.forEach(function(value, index, array) {
192 value.sel = true; 198 value.sel = true;
193 that.$forceUpdate() 199 that.$forceUpdate()
194 - newcartid.push(value.id)  
195 - 200 + newcartid.push(value.id);
  201 + that.cartid = newcartid
  202 +
196 }) 203 })
197 - this.data2.forEach(function(value, index, array){ 204 + this.data2.forEach(function(value, index, array) {
198 value.sel = true; 205 value.sel = true;
199 that.$forceUpdate() 206 that.$forceUpdate()
200 - newcartid.push(value.id)  
201 - 207 + newcartid.push(value.id);
  208 + that.cartid = newcartid
  209 +
202 }) 210 })
203 - this.data1[0].list.forEach(function(value, index, array){ 211 + this.data1[0].list.forEach(function(value, index, array) {
204 value.sel = true; 212 value.sel = true;
205 that.$forceUpdate() 213 that.$forceUpdate()
206 - newcartid.push(value.id)  
207 - 214 + newcartid.push(value.id);
  215 + that.cartid = newcartid
  216 +
208 }) 217 })
209 - 218 +
210 } else { 219 } else {
211 this.data3.forEach(function(value, index, array) { 220 this.data3.forEach(function(value, index, array) {
212 value.sel = false; 221 value.sel = false;
213 }) 222 })
214 - this.data2.forEach(function(value, index, array){  
215 - value.sel =false 223 + this.data2.forEach(function(value, index, array) {
  224 + value.sel = false
216 }) 225 })
217 - this.data1[0].list.forEach(function(value, index, array){  
218 - value.sel =false 226 + this.data1[0].list.forEach(function(value, index, array) {
  227 + value.sel = false
219 }) 228 })
220 -  
221 - newcartid=[]; 229 +
  230 + newcartid = [];
222 } 231 }
223 - that.cartid=newcartid; 232 + that.cartid = newcartid;
224 console.log(that.cartid) 233 console.log(that.cartid)
225 }, 234 },
226 -  
227 - delgood(){  
228 - let that = this;  
229 - console.log(that.cartid) 235 +
  236 + delgood() {
  237 + let that = this;
  238 + console.log(that.cartid)
  239 + uni.showModal({
  240 + title: '提示',
  241 + content: '是否删除该商品',
  242 + success: function(res) {
  243 + if (res.confirm) {
  244 +
  245 + var url = 'car/batch_delete';
  246 + var params = {
  247 + car_ids: that.cartid.join(",")
  248 + }
  249 + console.log(params)
  250 + app.post(url, params).then((res) => {
  251 + console.log(res);
  252 + uni.showToast({
  253 + title: '删除成功',
  254 + icon: "none"
  255 + })
  256 +
  257 + that.getcartlist()
  258 +
  259 + }).catch((err) => {
  260 + console.log(err)
  261 + })
  262 + } else if (res.cancel) {
  263 + console.log('用户点击取消');
  264 + }
  265 + }
  266 + });
  267 +
  268 + },
  269 + delgood() {
  270 + let that = this;
  271 + console.log(that.cartid)
230 uni.showModal({ 272 uni.showModal({
231 - title: '提示',  
232 - content: '是否删除该商品',  
233 - success: function (res) {  
234 - if (res.confirm) {  
235 -  
236 - var url = 'car/batch_delete';  
237 - var params = {  
238 - car_ids:that.cartid.join(",")  
239 - }  
240 - console.log(params)  
241 - app.post(url, params).then((res) => {  
242 - console.log(res);  
243 - uni.showToast({  
244 - title:'删除成功',  
245 - icon:"none" 273 + title: '提示',
  274 + content: '是否删除该商品',
  275 + success: function(res) {
  276 + if (res.confirm) {
  277 +
  278 + var url = 'car/batch_delete';
  279 + var params = {
  280 + car_ids: that.cartid.join(",")
  281 + }
  282 + console.log(params)
  283 + app.post(url, params).then((res) => {
  284 + console.log(res);
  285 + uni.showToast({
  286 + title: '删除成功',
  287 + icon: "none"
  288 + })
  289 +
  290 + that.getcartlist()
  291 +
  292 + }).catch((err) => {
  293 + console.log(err)
246 }) 294 })
247 -  
248 - that.getcartlist()  
249 -  
250 - }).catch((err) => {  
251 - console.log(err)  
252 - })  
253 - } else if (res.cancel) {  
254 - console.log('用户点击取消');  
255 - }  
256 - } 295 + } else if (res.cancel) {
  296 + console.log('用户点击取消');
  297 + }
  298 + }
257 }); 299 });
258 - 300 +
259 }, 301 },
260 // 积分商品 302 // 积分商品
261 jifenshop() { 303 jifenshop() {
@@ -274,211 +316,249 @@ @@ -274,211 +316,249 @@
274 getcartlist() { 316 getcartlist() {
275 let that = this; 317 let that = this;
276 var url = 'car/get_all'; 318 var url = 'car/get_all';
277 - var params = {  
278 - } 319 + var params = {}
279 console.log(params) 320 console.log(params)
280 app.post(url, params).then((res) => { 321 app.post(url, params).then((res) => {
281 console.log(res); 322 console.log(res);
282 that.data1 = res.data.data.data3; 323 that.data1 = res.data.data.data3;
283 that.data2 = res.data.data.data1; 324 that.data2 = res.data.data.data1;
284 that.data3 = res.data.data.data2; 325 that.data3 = res.data.data.data2;
  326 + let newlenarr = []
285 // 店铺商品 327 // 店铺商品
286 - that.data1[0].list.forEach(function(value,index,array){  
287 - value.sel = false;  
288 - })  
289 - that.data1=that.data1; 328 + if (that.data1.length != 0) {
  329 + that.data1[0].list.forEach(function(value, index, array) {
  330 + value.sel = false;
  331 + newlenarr.push(value)
  332 + })
  333 + that.data1 = that.data1;
  334 + }
  335 +
  336 +
290 // 面坊商品 337 // 面坊商品
291 - that.data2.forEach(function(value, index, array) {  
292 - value.sel = false;  
293 - })  
294 - that.data2 = that.data2; 338 + if (that.data2.length != 0) {
  339 + that.data2.forEach(function(value, index, array) {
  340 + value.sel = false;
  341 + newlenarr.push(value)
  342 + })
  343 + that.data2 = that.data2;
  344 + }
  345 +
295 console.log('738932893', that.data2) 346 console.log('738932893', that.data2)
296 // 积分商品 347 // 积分商品
297 - that.data3.forEach(function(value, index, array) {  
298 - value.sel = false  
299 - })  
300 - that.data3 = that.data3; 348 + if (that.data3.length != 0) {
  349 + that.data3.forEach(function(value, index, array) {
  350 + value.sel = false;
  351 + newlenarr.push(value)
  352 + })
  353 + that.data3 = that.data3;
  354 + }
  355 + this.lenarr = newlenarr
  356 +
301 }).catch((err) => { 357 }).catch((err) => {
302 console.log(err) 358 console.log(err)
303 }) 359 })
304 }, 360 },
305 -  
306 - //选择购物车  
307 - selectcart(item, index) {  
308 - console.log(item, index)  
309 - let that = this;  
310 - let newcartid=[]  
311 - let obj={}  
312 - if (item.type == 2) {  
313 - that.data3.forEach(function(value, index, array) {  
314 - if (value.id == item.id) {  
315 - value.sel = !value.sel;  
316 - that.$forceUpdate()  
317 - if (value.sel == true) {  
318 - that.arr.push(1)  
319 - that.total = that.total * 100 / 100 + value.score_goods.price * 100 / 100 * value.number;  
320 - newcartid.push(value.id);  
321 - console.log(3838944900)  
322 - console.log(newcartid);  
323 - that.cartid=newcartid  
324 - obj.type=item.type;  
325 - obj.goods_id=item.goods_id;  
326 - obj.spec_sku_id=item.spec_sku_id;  
327 - obj.number=item.number;  
328 - console.log('34898348',obj);  
329 - that.data.push(obj)  
330 - } else {  
331 - that.arr.splice(0,1)  
332 - that.total = that.total * 100 / 100 - value.score_goods.price * 100 / 100 * value.number;  
333 - that.data.forEach(function(value,index,array){  
334 - console.log(value.goods_id);  
335 - console.log(item.goods_id)  
336 - if(item.goods_id==value.goods_id){  
337 - console.log(34349349043)  
338 - that.data.splice(index,1) 361 + //选择购物车
  362 + selectcart(item, index) {
  363 + console.log(item, index)
  364 + let that = this;
  365 + let newcartid=[]
  366 + let obj={}
  367 + if (item.type == 2) {
  368 + that.data3.forEach(function(value, index, array) {
  369 + if (value.id == item.id) {
  370 + value.sel = !value.sel;
  371 + that.$forceUpdate()
  372 + if (value.sel == true) {
  373 + that.arr.push(1)
  374 + that.total = that.total * 100 / 100 + value.score_goods.price * 100 / 100 * value.number;
  375 + newcartid.push(value.id);
  376 + console.log(3838944900)
  377 + console.log(newcartid);
  378 + that.cartid=newcartid
  379 + obj.type=item.type;
  380 + obj.goods_id=item.goods_id;
  381 + obj.spec_sku_id=item.spec_sku_id;
  382 + obj.number=item.number;
  383 + console.log('34898348',obj);
  384 + that.data.push(obj);
  385 + if(that.cartid.length==that.lenarr.length){
  386 + that.selall=true;
  387 + that.seldelall=true
  388 + }
  389 + } else {
  390 + that.arr.splice(0,1)
  391 + that.total = that.total * 100 / 100 - value.score_goods.price * 100 / 100 * value.number;
  392 + that.data.forEach(function(value,index,array){
  393 + console.log(value.goods_id);
  394 + console.log(item.goods_id)
  395 + if(item.goods_id==value.goods_id){
  396 + console.log(34349349043)
  397 + that.data.splice(index,1)
  398 + }
  399 + })
  400 + newcartid.forEach(function(value,index,array){
  401 + if(value.id==item.id){
  402 + newcartid.splice(index,1)
  403 + }
  404 + })
  405 + that.selall=false;
  406 + that.seldelall=false
339 } 407 }
340 - })  
341 - newcartid.forEach(function(value,index,array){  
342 - if(value.id==item.id){  
343 - newcartid.splice(index,1)  
344 - }  
345 - })  
346 - }  
347 - that.data=that.data;  
348 -  
349 - }  
350 - })  
351 - that.data3 = that.data3  
352 - } else if (item.type == 1) {  
353 -  
354 - that.data2.forEach(function(value, index, array) {  
355 - if (value.id == item.id) {  
356 - value.sel = !value.sel; 408 + that.data=that.data;
  409 +
  410 + }
  411 + })
  412 + that.data3 = that.data3
  413 + } else if (item.type == 1) {
357 414
358 - that.$forceUpdate()  
359 - if (value.sel == true) {  
360 - that.arr.push(1);  
361 - newcartid.push(value.id);  
362 - that.total = that.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number;  
363 - obj.type=item.type;  
364 - obj.goods_id=item.goods_id;  
365 - obj.spec_sku_id=item.spec_sku_id;  
366 - obj.number=item.number;  
367 - that.data.push(obj)  
368 -  
369 - } else {  
370 - that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * value.number;  
371 - that.arr.splice(0,1);  
372 - that.data.forEach(function(value,index,array){  
373 - if(item.goods_id==value.goods_id){  
374 - that.data.splice(index,1)  
375 - }  
376 - })  
377 - newcartid.forEach(function(value,index,array){  
378 - if(value.id==item.id){  
379 - newcartid.splice(index,1) 415 + that.data2.forEach(function(value, index, array) {
  416 + if (value.id == item.id) {
  417 + value.sel = !value.sel;
  418 +
  419 + that.$forceUpdate()
  420 + if (value.sel == true) {
  421 + that.arr.push(1);
  422 + newcartid.push(value.id);
  423 + that.cartid=newcartid
  424 + that.total = that.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number;
  425 + obj.type=item.type;
  426 + obj.goods_id=item.goods_id;
  427 + obj.spec_sku_id=item.spec_sku_id;
  428 + obj.number=item.number;
  429 + that.data.push(obj);
  430 + if(that.cartid.length==that.lenarr.length){
  431 + that.selall=true;
  432 + that.seldelall=true
  433 + }
  434 +
  435 + } else {
  436 + that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * value.number;
  437 + that.arr.splice(0,1);
  438 + that.data.forEach(function(value,index,array){
  439 + if(item.goods_id==value.goods_id){
  440 + that.data.splice(index,1)
  441 + }
  442 + })
  443 + newcartid.forEach(function(value,index,array){
  444 + if(value.id==item.id){
  445 + newcartid.splice(index,1)
  446 + }
  447 + })
  448 + that.selall=false;
  449 + that.seldelall=false
380 } 450 }
381 - })  
382 - }  
383 - }  
384 - })  
385 - that.data2 = that.data2;  
386 - that.data=that.data;  
387 - console.log(that.data)  
388 - }else if(item.type==3){  
389 -  
390 - console.log('999888',that.data1[0].list)  
391 - that.data1[0].list.forEach(function(value, index, array) {  
392 - if (value.id == item.id) {  
393 - console.log('383483',value.id) 451 + }
  452 + })
  453 + that.data2 = that.data2;
  454 + that.data=that.data;
  455 + console.log(that.data)
  456 + }else if(item.type==3){
394 457
395 - value.sel = !value.sel; 458 + console.log('999888',that.data1[0].list)
  459 + that.data1[0].list.forEach(function(value, index, array) {
  460 + if (value.id == item.id) {
  461 + console.log('383483',value.id)
  462 +
  463 + value.sel = !value.sel;
  464 + that.$forceUpdate()
  465 + console.log(value.sel)
  466 + if (value.sel == true) {
  467 + console.log(value.sel)
  468 + that.arr.push(1);
  469 + newcartid.push(item.id);
  470 + that.cartid=newcartid;
  471 + that.total = that.total * 100 / 100 + value.store_goods.price * 100 / 100 * value.number;
  472 + obj.type=item.type;
  473 + obj.goods_id=item.goods_id;
  474 + obj.spec_sku_id=item.spec_sku_id;
  475 + obj.number=item.number;
  476 + that.data.push(obj);
  477 + if(that.cartid.length==that.lenarr.length){
  478 + that.selall=true;
  479 + that.seldelall=true
  480 + }
396 481
397 - that.$forceUpdate()  
398 - console.log(value.sel)  
399 - if (value.sel == true) {  
400 - console.log(value.sel)  
401 - that.arr.push(1);  
402 - newcartid.push(item.id);  
403 - that.total = that.total * 100 / 100 + value.store_goods.price * 100 / 100 * value.number;  
404 - obj.type=item.type;  
405 - obj.goods_id=item.goods_id;  
406 - obj.spec_sku_id=item.spec_sku_id;  
407 - obj.number=item.number;  
408 - that.data.push(obj)  
409 -  
410 - } else {  
411 - that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * value.number;  
412 - that.arr.splice(0,1);  
413 - that.data.forEach(function(value,index,array){  
414 - if(item.goods_id==value.goods_id){  
415 - that.data.splice(index,1)  
416 - }  
417 - })  
418 - newcartid.forEach(function(value,index,array){  
419 - if(value.id==item.id){  
420 - newcartid.splice(index,1) 482 + } else {
  483 + that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * value.number;
  484 + that.arr.splice(0,1);
  485 + that.data.forEach(function(value,index,array){
  486 + if(item.goods_id==value.goods_id){
  487 + that.data.splice(index,1)
  488 + }
  489 + })
  490 + newcartid.forEach(function(value,index,array){
  491 + if(value.id==item.id){
  492 + newcartid.splice(index,1)
  493 + }
  494 + })
  495 + that.selall=false;
  496 + that.seldelall=false
  497 +
421 } 498 }
422 - }) 499 + }
  500 + })
  501 + that.data1 = that.data1;
  502 + that.data=that.data;
  503 + that.cartid=newcartid;
  504 + if(that.cartid.length==that.lenarr.length){
  505 + that.selall=true;
  506 + that.seldelall=true
423 } 507 }
  508 + console.log(that.data);
  509 + console.log(that.cartid)
424 } 510 }
425 - })  
426 - that.data1 = that.data1;  
427 - that.data=that.data;  
428 - that.cartid=newcartid;  
429 - console.log(that.data);  
430 - console.log(that.cartid)  
431 - }  
432 -  
433 - }, 511 +
  512 + },
  513 +
434 // 选择全部购物车 514 // 选择全部购物车
435 selectall() { 515 selectall() {
436 - let that=this; 516 + let that = this;
437 this.selall = !this.selall; 517 this.selall = !this.selall;
438 - let newarr=[];  
439 - let newtotal=0;  
440 - let newcartid=[] 518 + let newarr = [];
  519 + let newtotal = 0;
  520 + let newcartid = []
441 if (this.selall == true) { 521 if (this.selall == true) {
442 this.data3.forEach(function(value, index, array) { 522 this.data3.forEach(function(value, index, array) {
443 value.sel = true; 523 value.sel = true;
444 newarr.push(1); 524 newarr.push(1);
445 - newtotal=newtotal+value.score_goods.price * 100 / 100 * value.number; 525 + newtotal = newtotal + value.score_goods.price * 100 / 100 * value.number;
446 newcartid.push(value.id) 526 newcartid.push(value.id)
447 // this.total = this.total * 100 / 100 + value.score_goods.price * 100 / 100 * value.number 527 // this.total = this.total * 100 / 100 + value.score_goods.price * 100 / 100 * value.number
448 }) 528 })
449 - this.data2.forEach(function(value, index, array){ 529 + this.data2.forEach(function(value, index, array) {
450 value.sel = true; 530 value.sel = true;
451 - newtotal=newtotal+value.flour_goods.price * 100 / 100 * value.number; 531 + newtotal = newtotal + value.flour_goods.price * 100 / 100 * value.number;
452 newcartid.push(value.id) 532 newcartid.push(value.id)
453 // this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number; 533 // this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number;
454 newarr.push(1) 534 newarr.push(1)
455 }) 535 })
456 - this.data1[0].list.forEach(function(value, index, array){ 536 + this.data1[0].list.forEach(function(value, index, array) {
457 value.sel = true; 537 value.sel = true;
458 - newtotal=newtotal+value.store_goods.price * 100 / 100 * value.number; 538 + newtotal = newtotal + value.store_goods.price * 100 / 100 * value.number;
459 newcartid.push(value.id) 539 newcartid.push(value.id)
460 // this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number; 540 // this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number;
461 newarr.push(1) 541 newarr.push(1)
462 }) 542 })
463 - 543 +
464 } else { 544 } else {
465 this.data3.forEach(function(value, index, array) { 545 this.data3.forEach(function(value, index, array) {
466 value.sel = false; 546 value.sel = false;
467 }) 547 })
468 - this.data2.forEach(function(value, index, array){  
469 - value.sel =false 548 + this.data2.forEach(function(value, index, array) {
  549 + value.sel = false
470 }) 550 })
471 - this.data1[0].list.forEach(function(value, index, array){  
472 - value.sel =false 551 + this.data1[0].list.forEach(function(value, index, array) {
  552 + value.sel = false
473 }) 553 })
474 - newarr=[];  
475 - newtotal=0;  
476 - newcartid=[]; 554 + newarr = [];
  555 + newtotal = 0;
  556 + newcartid = [];
477 } 557 }
478 this.data3 = this.data3; 558 this.data3 = this.data3;
479 - this.total=newtotal;  
480 - this.arr=newarr;  
481 - this.cartid=newcartid; 559 + this.total = newtotal;
  560 + this.arr = newarr;
  561 + this.cartid = newcartid;
482 562
483 }, 563 },
484 //购物车增加 564 //购物车增加
@@ -507,9 +587,9 @@ @@ -507,9 +587,9 @@
507 }) 587 })
508 that.data2 = that.data2; 588 that.data2 = that.data2;
509 589
510 - }else if(item.type==3){ 590 + } else if (item.type == 3) {
511 that.data1[0].list.forEach(function(value, index, array) { 591 that.data1[0].list.forEach(function(value, index, array) {
512 - console.log('3787478',value) 592 + console.log('3787478', value)
513 if (value.id == item.id) { 593 if (value.id == item.id) {
514 console.log(value.id); 594 console.log(value.id);
515 console.log(item.id) 595 console.log(item.id)
@@ -572,7 +652,7 @@ @@ -572,7 +652,7 @@
572 if (item.sel == true) { 652 if (item.sel == true) {
573 that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * 1; 653 that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * 1;
574 } 654 }
575 - }else{ 655 + } else {
576 uni.showToast({ 656 uni.showToast({
577 title: '不能再减少了~', 657 title: '不能再减少了~',
578 icon: 'none' 658 icon: 'none'
@@ -581,7 +661,7 @@ @@ -581,7 +661,7 @@
581 } 661 }
582 }) 662 })
583 that.data2 = that.data2; 663 that.data2 = that.data2;
584 - }else if(item.type==3){ 664 + } else if (item.type == 3) {
585 that.data1[0].list.forEach(function(value, index, array) { 665 that.data1[0].list.forEach(function(value, index, array) {
586 if (value.id == item.id) { 666 if (value.id == item.id) {
587 if (value.number > 1) { 667 if (value.number > 1) {
@@ -590,7 +670,7 @@ @@ -590,7 +670,7 @@
590 if (item.sel == true) { 670 if (item.sel == true) {
591 that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * 1; 671 that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * 1;
592 } 672 }
593 - }else{ 673 + } else {
594 uni.showToast({ 674 uni.showToast({
595 title: '不能再减少了~', 675 title: '不能再减少了~',
596 icon: 'none' 676 icon: 'none'
@@ -618,34 +698,36 @@ @@ -618,34 +698,36 @@
618 }) 698 })
619 }, 699 },
620 // 去结算 700 // 去结算
621 - jiesuan(){ 701 + jiesuan() {
622 let that = this; 702 let that = this;
623 - if(that.data.length==0){ 703 + if (that.data.length == 0) {
624 uni.showToast({ 704 uni.showToast({
625 - title:'请选择商品',  
626 - icon:'none' 705 + title: '请选择商品',
  706 + icon: 'none'
627 }) 707 })
628 return false 708 return false
629 } 709 }
  710 + uni.setStorageSync("addressitem","");
  711 + uni.setStorageSync("couponitem","")
630 var url = 'order/confirm_order'; 712 var url = 'order/confirm_order';
631 - console.log('获取的参数',that.data) 713 + console.log('获取的参数', that.data)
632 var params = { 714 var params = {
633 data: JSON.stringify(that.data), 715 data: JSON.stringify(that.data),
634 - 716 +
635 } 717 }
636 console.log(params) 718 console.log(params)
637 - app.post(url, params,"post").then((res) => { 719 + app.post(url, params, "post").then((res) => {
638 console.log(res); 720 console.log(res);
639 console.log(res.data.data); 721 console.log(res.data.data);
640 - let seldata=JSON.stringify(that.data)  
641 - uni.setStorageSync("goodinfo",res.data.data); 722 + let seldata = JSON.stringify(that.data)
  723 + uni.setStorageSync("goodinfo", res.data.data);
642 uni.navigateTo({ 724 uni.navigateTo({
643 - url:'/pages/nearshop/sureorder?seldata='+seldata 725 + url: '/pages/nearshop/sureorder?seldata=' + seldata
644 }) 726 })
645 - 727 +
646 }).catch((err) => { 728 }).catch((err) => {
647 console.log(err) 729 console.log(err)
648 - 730 +
649 }) 731 })
650 }, 732 },
651 733
@@ -660,25 +742,28 @@ @@ -660,25 +742,28 @@
660 page { 742 page {
661 background: #F8F6F9; 743 background: #F8F6F9;
662 } 744 }
663 - .editcart{  
664 - color:#3D454C; 745 +
  746 + .editcart {
  747 + color: #3D454C;
665 font-size: 28rpx; 748 font-size: 28rpx;
666 - width:750rpx; 749 + width: 750rpx;
667 background: #fff; 750 background: #fff;
668 text-align: right; 751 text-align: right;
669 padding: 0 32rpx; 752 padding: 0 32rpx;
670 box-sizing: border-box; 753 box-sizing: border-box;
671 } 754 }
672 - .quanname{  
673 - color:#3D454C; 755 +
  756 + .quanname {
  757 + color: #3D454C;
674 font-size: 28rpx; 758 font-size: 28rpx;
675 } 759 }
676 - .delgoodname{  
677 - width:280rpx;  
678 - height:88rpx;  
679 - background:rgba(194,148,69,1);  
680 - border-radius:16rpx;  
681 - color:#fff; 760 +
  761 + .delgoodname {
  762 + width: 280rpx;
  763 + height: 88rpx;
  764 + background: rgba(194, 148, 69, 1);
  765 + border-radius: 16rpx;
  766 + color: #fff;
682 font-size: 28rpx; 767 font-size: 28rpx;
683 text-align: center; 768 text-align: center;
684 line-height: 88rpx; 769 line-height: 88rpx;
@@ -687,10 +772,12 @@ @@ -687,10 +772,12 @@
687 .cartlist { 772 .cartlist {
688 /* padding-bottom: 120rpx; */ 773 /* padding-bottom: 120rpx; */
689 } 774 }
690 - .spec{  
691 - color:#3D454C; 775 +
  776 + .spec {
  777 + color: #3D454C;
692 font-size: 28rpx; 778 font-size: 28rpx;
693 } 779 }
  780 +
694 .cartselimg { 781 .cartselimg {
695 width: 30rpx; 782 width: 30rpx;
696 height: 30rpx; 783 height: 30rpx;
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 </view> 20 </view>
21 <view class="sureshop sureshopk"> 21 <view class="sureshop sureshopk">
22 <!-- 店铺商品 --> 22 <!-- 店铺商品 -->
23 - <view class="bigbox" v-if="goodinfo.data3[0].goods!=undefined"> 23 + <view class="bigbox" v-if="goodinfo.data3.length!=0">
24 <view class="sureorderbox flexone"> 24 <view class="sureorderbox flexone">
25 <view class="sureimg"> 25 <view class="sureimg">
26 <image src="../../static/nearshop.png" mode=""></image> 26 <image src="../../static/nearshop.png" mode=""></image>
@@ -252,65 +252,74 @@ @@ -252,65 +252,74 @@
252 </view> 252 </view>
253 </view> 253 </view>
254 254
255 - <view class="huiyuanbot boxsizing">  
256 - <view class="behuiyuanbtn">确认支付</view> 255 + <view class="huiyuanbot boxsizing flextwo">
  256 + <view class="surezhifu">总计:{{goodinfo.total}}</view>
  257 + <view class="behuiyuanbtn behuiyuanbtnk" @click="surepay">确认支付</view>
257 </view> 258 </view>
258 259
259 <!-- 购买弹层 --> 260 <!-- 购买弹层 -->
260 <view class="register" @click="hidebuy" v-if="buyshow"> 261 <view class="register" @click="hidebuy" v-if="buyshow">
261 <view class="buywrap boxsizing"> 262 <view class="buywrap boxsizing">
262 <view class="buyname">订单总额</view> 263 <view class="buyname">订单总额</view>
263 - <view class="buymoney">3600</view> 264 + <view class="buymoney">{{goodinfo.total}}</view>
264 <view class='buybox'> 265 <view class='buybox'>
265 - <view class="buyitem boxsizing flextwo"> 266 + <view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="1">
266 <view class="buyitemleft flexone"> 267 <view class="buyitemleft flexone">
267 - <view class="buyleftimg">  
268 - <image src="../../static/zhifubao.png" mode=""></image> 268 + <view class="buyleftimg" >
  269 +
  270 + <image src="../../static/weixin.png" mode=""></image>
269 </view> 271 </view>
270 - <view class="buyitemname">支付宝</view> 272 + <view class="buyitemname">微信支付</view>
271 </view> 273 </view>
272 - <view class="selimg">  
273 - <image src="../../static/selactive.png" mode=""></image> 274 + <view class="selimg" >
  275 + <image src="../../static/selactive.png" mode="" v-if="pay_type==1"></image>
  276 + <image src="../../static/active.png" mode="" v-else></image>
274 </view> 277 </view>
275 </view> 278 </view>
276 <view class="buyitem boxsizing flextwo"> 279 <view class="buyitem boxsizing flextwo">
277 <view class="buyitemleft flexone"> 280 <view class="buyitemleft flexone">
278 <view class="buyleftimg"> 281 <view class="buyleftimg">
279 - <image src="../../static/weixin.png" mode=""></image> 282 +
  283 + <image src="../../static/zhifubao.png" mode=""></image>
280 </view> 284 </view>
281 - <view class="buyitemname">微信支付</view> 285 + <view class="buyitemname">支付宝</view>
282 </view> 286 </view>
283 - <view class="selimg">  
284 - <image src="../../static/selactive.png" mode=""></image> 287 + <view class="selimg" @click.stop="paytype" :data-id="2">
  288 + <image src="../../static/selactive.png" mode="" v-if="pay_type==2"></image>
  289 + <image src="../../static/active.png" mode="" v-else></image>
285 </view> 290 </view>
286 </view> 291 </view>
287 - <view class="buyitem boxsizing flextwo"> 292 +
  293 + <view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="3">
288 <view class="buyitemleft flexone"> 294 <view class="buyitemleft flexone">
289 - <view class="buyleftimg">  
290 - <image src="../../static/yue.png" mode=""></image> 295 + <view class="buyleftimg" >
  296 + <image src="../../static/yue.png" mode="" ></image>
291 </view> 297 </view>
292 <view class="buyitemname">余额支付</view> 298 <view class="buyitemname">余额支付</view>
293 </view> 299 </view>
294 - <view class="selimg">  
295 - <image src="../../static/selactive.png" mode=""></image> 300 + <view class="selimg" >
  301 + <image src="../../static/selactive.png" mode="" v-if="pay_type==3"></image>
  302 + <image src="../../static/active.png" mode="" v-else></image>
296 </view> 303 </view>
297 </view> 304 </view>
298 - <view class="buyitem boxsizing flextwo"> 305 + <view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="4">
299 <view class="buyitemleft flexone"> 306 <view class="buyitemleft flexone">
300 <view class="buyleftimg"> 307 <view class="buyleftimg">
301 - <image src="../../static/baitiao.png" mode=""></image> 308 +
  309 + <image src="../../static/baitiao.png" mode="" ></image>
302 </view> 310 </view>
303 - <view class="buyitemname">白条支付</view> 311 + <view class="buyitemname">赊吧支付</view>
304 </view> 312 </view>
305 - <view class="selimg">  
306 - <image src="../../static/selactive.png" mode=""></image> 313 + <view class="selimg" >
  314 + <image src="../../static/selactive.png" mode="" v-if="pay_type==4"></image>
  315 + <image src="../../static/active.png" mode="" v-else></image>
307 </view> 316 </view>
308 </view> 317 </view>
309 </view> 318 </view>
310 - <view class="flextwo">  
311 - <view class="totalmoney">{{goodinfo.total}}</view>  
312 - <view class="buybtn btnk">确认支付(¥2560.00)</view>  
313 - </view> 319 +
  320 +
  321 + <view class="buybtn btnk" @click="paynow">确认支付(¥{{goodinfo.total}})</view>
  322 +
314 323
315 </view> 324 </view>
316 </view> 325 </view>
@@ -381,6 +390,8 @@ @@ -381,6 +390,8 @@
381 name:'上门自提' 390 name:'上门自提'
382 }], 391 }],
383 goodpeiname:'请选择配送方式', 392 goodpeiname:'请选择配送方式',
  393 + pay_type:-1,
  394 + user_ticket_id:''
384 395
385 396
386 397
@@ -398,6 +409,11 @@ @@ -398,6 +409,11 @@
398 }, 409 },
399 410
400 methods: { 411 methods: {
  412 +
  413 + // 选择支付方式
  414 + paytype(e){
  415 + this.pay_type=e.currentTarget.dataset.id
  416 + },
401 // 面访商品配送方式 417 // 面访商品配送方式
402 bindmianChange(e){ 418 bindmianChange(e){
403 this.mianpeiname=this.servicearr[e.target.value].name; 419 this.mianpeiname=this.servicearr[e.target.value].name;
@@ -430,17 +446,21 @@ @@ -430,17 +446,21 @@
430 }, 446 },
431 447
432 // 面坊商品备注 448 // 面坊商品备注
433 - entermianfangrmark(){  
434 - this.remark1=e.detail.value 449 + entermianfangrmark(e){
  450 + console.log(e)
  451 + this.remark1=e.detail.value;
  452 + console.log(this.remark1)
435 }, 453 },
436 // 店铺商品备注 454 // 店铺商品备注
437 entershopmessage(e){ 455 entershopmessage(e){
  456 +
438 this.seldata.forEach(function(value,index,array){ 457 this.seldata.forEach(function(value,index,array){
439 if(value.type==3){ 458 if(value.type==3){
440 value.remark=e.detail.value 459 value.remark=e.detail.value
441 } 460 }
442 }) 461 })
443 this.seldata=this.this.seldata; 462 this.seldata=this.this.seldata;
  463 + console.log(this.seldata)
444 }, 464 },
445 // 积分商品备注 465 // 积分商品备注
446 enterjifenremark(){ 466 enterjifenremark(){
@@ -487,17 +507,63 @@ @@ -487,17 +507,63 @@
487 console.log(err) 507 console.log(err)
488 508
489 }) 509 })
  510 + },
  511 + //确认支付
  512 + surepay(){
  513 + this.buyshow=true
  514 + },
  515 + hidebuy(){
  516 + this.buyshow=false
  517 + },
  518 + // 确认支付
  519 + paynow(){
  520 + let that = this;
  521 + // if(that.data.length==0){
  522 + // uni.showToast({
  523 + // title:'请选择商品',
  524 + // icon:'none'
  525 + // })
  526 + // return false
  527 + // }
  528 + var url = 'order/create_order';
  529 + var params = {
  530 + data: JSON.stringify(that.seldata),
  531 + user_ticket_id:that.user_ticket_id,
  532 + postage_type1:that.postage_type1,
  533 + postage_type2:that.postage_type2,
  534 + score:that.jifen,
  535 + remark1:that.remark1,
  536 + remark2:that.remark2,
  537 + pay_type:that.pay_type
  538 +
  539 + }
  540 + console.log(that.seldata)
  541 + console.log(params)
  542 + app.post(url, params,"post").then((res) => {
  543 + console.log(res);
  544 + uni.navigateTo({
  545 + url:'/pages/nearshop/sureorder'
  546 + })
  547 +
  548 + }).catch((err) => {
  549 + console.log(err)
  550 +
  551 + })
490 } 552 }
491 553
492 554
493 }, 555 },
494 onShow() { 556 onShow() {
  557 + console.log(uni.getStorageSync("addressitem"))
495 if(uni.getStorageSync("addressitem")!=''){ 558 if(uni.getStorageSync("addressitem")!=''){
496 this.addressitem = uni.getStorageSync("addressitem"); 559 this.addressitem = uni.getStorageSync("addressitem");
497 } 560 }
498 - if(uni.getStorageSync("addressitem")!=''){ 561 + if(uni.getStorageSync("couponitem")!=''){
499 let couponitem = uni.getStorageSync("couponitem"); 562 let couponitem = uni.getStorageSync("couponitem");
500 - this.couponname=couponitem.name 563 + console.log(couponitem)
  564 + this.couponname=couponitem.name;
  565 + console.log(this.couponname)
  566 + this.user_ticket_id=couponitem.id
501 } 567 }
502 568
503 console.log(this.addressitem) 569 console.log(this.addressitem)
@@ -519,6 +585,8 @@ @@ -519,6 +585,8 @@
519 } 585 }
520 .btnk{ 586 .btnk{
521 width:200prx; 587 width:200prx;
522 - 588 + }
  589 + .buywrap{
  590 + z-index:999
523 } 591 }
524 </style> 592 </style>