Commit ec82954b4c8483b868390b167b7a0b0c4578cfe1
1 parent
5b8cddaf
1、 购物车的支付失败的跳转优化
2、订单列表的支付转圈的优化
Showing
5 changed files
with
168 additions
and
169 deletions
packageA/pages/serviceCard_pd/cart/cart.js
| ... | ... | @@ -472,12 +472,7 @@ Page({ |
| 472 | 472 | |
| 473 | 473 | //-- 支付失败,要返回 -- |
| 474 | 474 | setTimeout(function () { |
| 475 | - var cps = getCurrentPages(); | |
| 476 | - if (cps.length > 1) { | |
| 477 | - wx.navigateBack({ delta: 1 }) | |
| 478 | - } else { | |
| 479 | - getApp().goto("/pages/index/index/index"); | |
| 480 | - } | |
| 475 | + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); | |
| 481 | 476 | }, 1000) |
| 482 | 477 | |
| 483 | 478 | }) | ... | ... |
packageE/pages/cart/cart2/cart2.js
| ... | ... | @@ -5243,17 +5243,10 @@ Page({ |
| 5243 | 5243 | |
| 5244 | 5244 | }, function () { |
| 5245 | 5245 | |
| 5246 | - | |
| 5247 | 5246 | // return false; |
| 5248 | 5247 | //支付失败 |
| 5249 | 5248 | setTimeout(function () { |
| 5250 | - var cps = getCurrentPages(); | |
| 5251 | - if (cps.length > 1) { | |
| 5252 | - wx.navigateBack({ delta: 1 }) | |
| 5253 | - } else { | |
| 5254 | - getApp().goto("/pages/index/index/index"); | |
| 5255 | - } | |
| 5256 | - | |
| 5249 | + getApp().re_to("/pages/user/order_list/order_list"); | |
| 5257 | 5250 | }, 1000) |
| 5258 | 5251 | }, oo.stoid); |
| 5259 | 5252 | ... | ... |
packageE/pages/cart/cart2_inte/cart2_inte.js
pages/user/order_list/order_list.js
| ... | ... | @@ -244,182 +244,191 @@ Page({ |
| 244 | 244 | |
| 245 | 245 | th.setData({ is_get: 1 }); |
| 246 | 246 | var data = e.data.orderList; |
| 247 | - data.forEach(async function (item, ind) { | |
| 248 | - var tt = null; | |
| 249 | - await getApp().request.promiseGet('/api/weshop/ordergoods/list', { | |
| 250 | - data: { order_id: item.order_id, store_id: os.stoid, pageSize: 600 }, | |
| 251 | - }).then(res => { | |
| 252 | - tt = res; | |
| 253 | - }) | |
| 254 | - var glist = tt.data.data.pageData; | |
| 255 | - for (var i in glist) { | |
| 256 | - if (glist[i].is_gift) { | |
| 257 | - data[ind].is_prom = 1; | |
| 258 | - } | |
| 259 | - } | |
| 260 | 247 | |
| 261 | - data[ind]['ord_url'] = '/pages/user/order_detail/order_detail'; | |
| 262 | - //-- 如果是优惠活动 -- | |
| 263 | - if (glist[0].prom_type == 8) { | |
| 264 | - await getApp().request.promiseGet('/api/weshop/order/orderPresell/get/' + os.stoid + '/' + item.order_id, { | |
| 248 | + //-- 如果有值的时候 -- | |
| 249 | + if(data && data.length){ | |
| 250 | + data.forEach(async function (item, ind) { | |
| 251 | + var tt = null; | |
| 252 | + await getApp().request.promiseGet('/api/weshop/ordergoods/list', { | |
| 253 | + data: { order_id: item.order_id, store_id: os.stoid, pageSize: 600 }, | |
| 265 | 254 | }).then(res => { |
| 266 | - if (res.data.code == 0) { | |
| 267 | - data[ind]['presell'] = res.data.data; | |
| 268 | - data[ind]['ord_url'] = '/packageC/pages/presell/cart/cart'; | |
| 269 | - } | |
| 255 | + tt = res; | |
| 270 | 256 | }) |
| 271 | - } | |
| 272 | - // 如果是幸运购活动 | |
| 273 | - if (glist[0].prom_type == 9) { | |
| 274 | - await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/list', { | |
| 275 | - data: { | |
| 276 | - store_id: os.stoid, | |
| 277 | - user_id: oo.user_id, | |
| 278 | - order_id: item.order_id, | |
| 257 | + var glist = tt.data.data.pageData; | |
| 258 | + for (var i in glist) { | |
| 259 | + if (glist[i].is_gift) { | |
| 260 | + data[ind].is_prom = 1; | |
| 279 | 261 | } |
| 280 | - }).then(res => { | |
| 281 | - if (res.data.code == 0) { | |
| 282 | - // console.log('luckyGo+++++++++>>>', res.data.data); | |
| 283 | - // data[ind]['team_status'] = res.data.data[0]['team_status']; | |
| 284 | - if (res.data.data[0] && res.data.data[0]['team_status']) { | |
| 285 | - data[ind]['team_status'] = res.data.data[0]['team_status']; | |
| 286 | - } else { | |
| 287 | - data[ind]['team_status'] = 0; | |
| 288 | - }; | |
| 262 | + } | |
| 289 | 263 | |
| 290 | - // data[ind]['ord_url']='/packageC/pages/presell/cart/cart'; | |
| 264 | + data[ind]['ord_url'] = '/pages/user/order_detail/order_detail'; | |
| 265 | + //-- 如果是优惠活动 -- | |
| 266 | + if (glist[0].prom_type == 8) { | |
| 267 | + await getApp().request.promiseGet('/api/weshop/order/orderPresell/get/' + os.stoid + '/' + item.order_id, { | |
| 268 | + }).then(res => { | |
| 269 | + if (res.data.code == 0) { | |
| 270 | + data[ind]['presell'] = res.data.data; | |
| 271 | + data[ind]['ord_url'] = '/packageC/pages/presell/cart/cart'; | |
| 272 | + } | |
| 273 | + }) | |
| 274 | + } | |
| 275 | + // 如果是幸运购活动 | |
| 276 | + if (glist[0].prom_type == 9) { | |
| 277 | + await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/list', { | |
| 278 | + data: { | |
| 279 | + store_id: os.stoid, | |
| 280 | + user_id: oo.user_id, | |
| 281 | + order_id: item.order_id, | |
| 282 | + } | |
| 283 | + }).then(res => { | |
| 284 | + if (res.data.code == 0) { | |
| 285 | + // console.log('luckyGo+++++++++>>>', res.data.data); | |
| 286 | + // data[ind]['team_status'] = res.data.data[0]['team_status']; | |
| 287 | + if (res.data.data[0] && res.data.data[0]['team_status']) { | |
| 288 | + data[ind]['team_status'] = res.data.data[0]['team_status']; | |
| 289 | + } else { | |
| 290 | + data[ind]['team_status'] = 0; | |
| 291 | + }; | |
| 292 | + | |
| 293 | + // data[ind]['ord_url']='/packageC/pages/presell/cart/cart'; | |
| 294 | + } | |
| 295 | + }) | |
| 296 | + } | |
| 297 | + //------------对比一下有没有退款记录------------ | |
| 298 | + await getApp().request.promiseGet("/api/weshop/order/returngoods/page", { | |
| 299 | + data: { | |
| 300 | + order_id: item.order_id, store_id: os.stoid, | |
| 301 | + user_id: oo.user_id, pageSize: 20 | |
| 291 | 302 | } |
| 292 | - }) | |
| 293 | - } | |
| 294 | - //------------对比一下有没有退款记录------------ | |
| 295 | - await getApp().request.promiseGet("/api/weshop/order/returngoods/page", { | |
| 296 | - data: { | |
| 297 | - order_id: item.order_id, store_id: os.stoid, | |
| 298 | - user_id: oo.user_id, pageSize: 20 | |
| 299 | - } | |
| 300 | - }).then(rs => { | |
| 301 | - var ttd = rs; | |
| 302 | - //--看一下订单的总数量-- | |
| 303 | - var gtype_num = tt.data.data.total; | |
| 304 | - if (ttd.data.data.pageData == undefined) return false; | |
| 305 | - var goodslist = tt.data.data.pageData; | |
| 306 | - | |
| 307 | - //----没有相关的退款记录---- | |
| 308 | - if (ttd.data.data.total == 0) { | |
| 309 | - data[ind]['is_all_return'] = 0; | |
| 310 | - goodslist.forEach(function (ee, ii) { | |
| 311 | - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num > 1) { | |
| 312 | - item.goodslist = goodslist; | |
| 313 | - if (th.check_for_return_btn(item)) { | |
| 314 | - goodslist[ii]['return_btn'] = 1; | |
| 303 | + }).then(rs => { | |
| 304 | + var ttd = rs; | |
| 305 | + //--看一下订单的总数量-- | |
| 306 | + var gtype_num = tt.data.data.total; | |
| 307 | + if (ttd.data.data.pageData == undefined) return false; | |
| 308 | + var goodslist = tt.data.data.pageData; | |
| 309 | + | |
| 310 | + //----没有相关的退款记录---- | |
| 311 | + if (ttd.data.data.total == 0) { | |
| 312 | + data[ind]['is_all_return'] = 0; | |
| 313 | + goodslist.forEach(function (ee, ii) { | |
| 314 | + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num > 1) { | |
| 315 | + item.goodslist = goodslist; | |
| 316 | + if (th.check_for_return_btn(item)) { | |
| 317 | + goodslist[ii]['return_btn'] = 1; | |
| 318 | + } | |
| 315 | 319 | } |
| 316 | - } | |
| 317 | 320 | |
| 318 | - }); | |
| 319 | - } else { | |
| 320 | - //--------整单退-------- | |
| 321 | - if (ttd.data.data.pageData[0]['goods_id_list'] != null | |
| 322 | - && ttd.data.data.pageData[0]['goods_id_list'] != '') { | |
| 323 | - var eea = ttd.data.data.pageData[0]; | |
| 324 | - //1.退款正在进行中, | |
| 325 | - //2.退款被拒绝就要显示可以退款 | |
| 326 | - //3.退款已经完成 | |
| 327 | - data[ind]['is_all_return'] = 1; | |
| 328 | - data[ind]['is_all_return_status'] = ttd.data.data.pageData[0].status; | |
| 329 | - | |
| 330 | - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { | |
| 331 | - switch (eea.status) { | |
| 332 | - case 0: | |
| 333 | - case 1: | |
| 334 | - data[ind]['return_btn'] = 2; | |
| 335 | - break; | |
| 336 | - case 2: | |
| 337 | - data[ind]['return_btn'] = 4; | |
| 338 | - break; | |
| 339 | - case 3: | |
| 340 | - data[ind]['return_btn'] = 3; | |
| 341 | - break; | |
| 342 | - default: | |
| 343 | - data[ind]['return_btn'] = 0; | |
| 344 | - } | |
| 345 | - } | |
| 321 | + }); | |
| 346 | 322 | } else { |
| 347 | - //1.退款正在进行中, | |
| 348 | - //2.退款被拒绝就要显示可以退款 | |
| 349 | - //3.退款已经完成 | |
| 350 | - data[ind]['is_all_return'] = 0; | |
| 351 | - var rt_ok_num = 0; | |
| 352 | - //if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { | |
| 353 | - goodslist.forEach(function (eeb, iii) { | |
| 354 | - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) | |
| 355 | - goodslist[iii]['return_btn'] = 1; //申请退款 | |
| 356 | - ttd.data.data.pageData.forEach(function (eea, ii) { | |
| 357 | - var st = eea.status; | |
| 358 | - if (eea.goods_id == eeb.goods_id) { | |
| 359 | - switch (eea.status) { | |
| 360 | - case 0: | |
| 361 | - case 1://退款处理中 | |
| 362 | - data[ind]['has_rt'] = 1; //有部分退 | |
| 363 | - goodslist[iii]['return_btn'] = 2; | |
| 364 | - break; | |
| 365 | - case 2://退款完成 | |
| 366 | - data[ind]['has_rt'] = 1; //有部分退 | |
| 367 | - goodslist[iii]['return_btn'] = 4; | |
| 368 | - rt_ok_num++; | |
| 369 | - break; | |
| 370 | - case 3://已拒绝,重新退款 | |
| 371 | - goodslist[iii]['return_btn'] = 3; | |
| 372 | - break; | |
| 373 | - default: | |
| 374 | - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) | |
| 375 | - goodslist[iii]['return_btn'] = 1; //申请退款 | |
| 376 | - } | |
| 377 | - return; | |
| 323 | + //--------整单退-------- | |
| 324 | + if (ttd.data.data.pageData[0]['goods_id_list'] != null | |
| 325 | + && ttd.data.data.pageData[0]['goods_id_list'] != '') { | |
| 326 | + var eea = ttd.data.data.pageData[0]; | |
| 327 | + //1.退款正在进行中, | |
| 328 | + //2.退款被拒绝就要显示可以退款 | |
| 329 | + //3.退款已经完成 | |
| 330 | + data[ind]['is_all_return'] = 1; | |
| 331 | + data[ind]['is_all_return_status'] = ttd.data.data.pageData[0].status; | |
| 332 | + | |
| 333 | + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { | |
| 334 | + switch (eea.status) { | |
| 335 | + case 0: | |
| 336 | + case 1: | |
| 337 | + data[ind]['return_btn'] = 2; | |
| 338 | + break; | |
| 339 | + case 2: | |
| 340 | + data[ind]['return_btn'] = 4; | |
| 341 | + break; | |
| 342 | + case 3: | |
| 343 | + data[ind]['return_btn'] = 3; | |
| 344 | + break; | |
| 345 | + default: | |
| 346 | + data[ind]['return_btn'] = 0; | |
| 378 | 347 | } |
| 348 | + } | |
| 349 | + } else { | |
| 350 | + //1.退款正在进行中, | |
| 351 | + //2.退款被拒绝就要显示可以退款 | |
| 352 | + //3.退款已经完成 | |
| 353 | + data[ind]['is_all_return'] = 0; | |
| 354 | + var rt_ok_num = 0; | |
| 355 | + //if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { | |
| 356 | + goodslist.forEach(function (eeb, iii) { | |
| 357 | + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) | |
| 358 | + goodslist[iii]['return_btn'] = 1; //申请退款 | |
| 359 | + ttd.data.data.pageData.forEach(function (eea, ii) { | |
| 360 | + var st = eea.status; | |
| 361 | + if (eea.goods_id == eeb.goods_id) { | |
| 362 | + switch (eea.status) { | |
| 363 | + case 0: | |
| 364 | + case 1://退款处理中 | |
| 365 | + data[ind]['has_rt'] = 1; //有部分退 | |
| 366 | + goodslist[iii]['return_btn'] = 2; | |
| 367 | + break; | |
| 368 | + case 2://退款完成 | |
| 369 | + data[ind]['has_rt'] = 1; //有部分退 | |
| 370 | + goodslist[iii]['return_btn'] = 4; | |
| 371 | + rt_ok_num++; | |
| 372 | + break; | |
| 373 | + case 3://已拒绝,重新退款 | |
| 374 | + goodslist[iii]['return_btn'] = 3; | |
| 375 | + break; | |
| 376 | + default: | |
| 377 | + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) | |
| 378 | + goodslist[iii]['return_btn'] = 1; //申请退款 | |
| 379 | + } | |
| 380 | + return; | |
| 381 | + } | |
| 382 | + }); | |
| 379 | 383 | }); |
| 380 | - }); | |
| 381 | - //} | |
| 384 | + //} | |
| 385 | + } | |
| 382 | 386 | } |
| 383 | - } | |
| 384 | 387 | |
| 385 | - //--如果是全部退款,也就可以删除-- | |
| 386 | - if (rt_ok_num == goodslist.length) { | |
| 387 | - data[ind]['is_all_return_status'] = 2; | |
| 388 | - } | |
| 388 | + //--如果是全部退款,也就可以删除-- | |
| 389 | + if (rt_ok_num == goodslist.length) { | |
| 390 | + data[ind]['is_all_return_status'] = 2; | |
| 391 | + } | |
| 389 | 392 | |
| 390 | 393 | |
| 391 | - data[ind]['order_goods'] = goodslist; | |
| 392 | - var g_num = 0; | |
| 393 | - goodslist.forEach(function (ee, ii) { | |
| 394 | - if (ee.return_btn != 4) | |
| 395 | - g_num += ee.goods_num; | |
| 396 | - }); | |
| 397 | - data[ind]['g_num'] = g_num; | |
| 398 | - }) | |
| 394 | + data[ind]['order_goods'] = goodslist; | |
| 395 | + var g_num = 0; | |
| 396 | + goodslist.forEach(function (ee, ii) { | |
| 397 | + if (ee.return_btn != 4) | |
| 398 | + g_num += ee.goods_num; | |
| 399 | + }); | |
| 400 | + data[ind]['g_num'] = g_num; | |
| 401 | + }) | |
| 399 | 402 | |
| 400 | 403 | |
| 401 | - data[ind].use_commission = 0; | |
| 402 | - //-- 如果有数据的话 -- | |
| 403 | - await getApp().request.promiseGet("/api/weshop/orderMore/get/" + os.stoid + "/" + item.order_sn, { | |
| 404 | + data[ind].use_commission = 0; | |
| 405 | + //-- 如果有数据的话 -- | |
| 406 | + await getApp().request.promiseGet("/api/weshop/orderMore/get/" + os.stoid + "/" + item.order_sn, { | |
| 407 | + | |
| 408 | + }).then(res => { | |
| 409 | + if (res.data.code == 0 && res.data.data) { | |
| 410 | + data[ind].use_commission = res.data.data.use_commission; | |
| 411 | + data[ind].pre_cut = res.data.data.pre_cut; //是否使用预存,如果是使用预存不能单品退,只能整单退 | |
| 412 | + data[ind].pre_json = res.data.data.pre_json; //是否使用预存,如果是使用预存不能单品退,只能整单退 | |
| 413 | + } | |
| 414 | + }) | |
| 404 | 415 | |
| 405 | - }).then(res => { | |
| 406 | - if (res.data.code == 0 && res.data.data) { | |
| 407 | - data[ind].use_commission = res.data.data.use_commission; | |
| 408 | - data[ind].pre_cut = res.data.data.pre_cut; //是否使用预存,如果是使用预存不能单品退,只能整单退 | |
| 409 | - data[ind].pre_json = res.data.data.pre_json; //是否使用预存,如果是使用预存不能单品退,只能整单退 | |
| 410 | - } | |
| 411 | - }) | |
| 412 | 416 | |
| 417 | + th.setData({ orderList: data, }); | |
| 413 | 418 | |
| 414 | - th.setData({ orderList: data, }); | |
| 419 | + wx.hideLoading(); | |
| 415 | 420 | |
| 421 | + }); | |
| 422 | + e.data.currentPage++, wx.stopPullDownRefresh(); | |
| 423 | + } | |
| 424 | + else { | |
| 425 | + //直接关闭加载中的动画 | |
| 416 | 426 | wx.hideLoading(); |
| 427 | + } | |
| 428 | + | |
| 417 | 429 | |
| 418 | - }); | |
| 419 | 430 | |
| 420 | 431 | |
| 421 | - e.data.currentPage++, | |
| 422 | - wx.stopPullDownRefresh(); | |
| 423 | 432 | }, null, { store_id: os.stoid, user_id: oo.user_id }); |
| 424 | 433 | }, |
| 425 | 434 | ... | ... |
utils/util.js
| ... | ... | @@ -898,8 +898,6 @@ module.exports = { |
| 898 | 898 | err_url="/pages/index/index/index"; |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - | |
| 902 | - | |
| 903 | 901 | let options = wx.getEnterOptionsSync(); |
| 904 | 902 | if (options.scene == '1038' && options.referrerInfo.appId=='wxef277996acc166c3') { |
| 905 | 903 | let extraData = options.referrerInfo.extraData; |
| ... | ... | @@ -932,6 +930,10 @@ module.exports = { |
| 932 | 930 | // "支付已取消"; |
| 933 | 931 | else if (extraData.code == 'cancel') { |
| 934 | 932 | this.m_toast("取消支付") |
| 933 | + | |
| 934 | + console.log('err_url-11'); | |
| 935 | + console.log(err_url); | |
| 936 | + | |
| 935 | 937 | //支付失败 |
| 936 | 938 | setTimeout(function () { |
| 937 | 939 | if(err_url=='back'){ |
| ... | ... | @@ -944,7 +946,7 @@ module.exports = { |
| 944 | 946 | if(is_navigateTo){ |
| 945 | 947 | getApp.goto({ url: err_url, }) //跳到tabbar页 |
| 946 | 948 | }else { |
| 947 | - wxd.redirectTo(err_url); | |
| 949 | + wx.redirectTo({ url: err_url}); | |
| 948 | 950 | } |
| 949 | 951 | } |
| 950 | 952 | ... | ... |