Files
Gaoxs bf2fd75e8d 1、首页 首发新品与精品推荐去掉
2、拼团收藏点击收藏显示的黑色,应该是红色吧
3、拼团开团选择规格 价格上面商品标题没显示
4、下单余额支付 立即结算怎么付款不了,其实是付款 怎么还是当前页面 什么也没提示,就提示订单生成中
6、拼团海报显示的原价是null
7、秒杀列表 限时价格没出来(后端返回如果sku多个返回最小价格)
8、秒杀详情价格没出来,立刻购买旁边还有原价购买(看下原来h5),收藏的按钮也显示出来
10、砍价点击立刻砍价下 提示的框跑到右下角了!!!
11、我的商品收藏一直加载中数据出不来
13、商户管理 订单详情下单时间显示不对
14、优惠券背景也没显示出来,首页天天惠买单跳转到领取优惠券页面,不是我到优惠券页面
15、下次再次提交体验版 把充值也放开,也一块测试测试
16、立即提现页面,上面到微信与支付宝tab替换成普通到tab,不要这样子的,替换成跟下单时候选择快递配送或者到店自提那种tab
17、提现没有提示,当前金额0,提现金额1,提交的时候提示下提现金额足不
2020-09-10 16:38:16 +08:00

165 lines
4.1 KiB
JavaScript

import { cancelOrder, takeOrder, delOrder, payOrder } from "@/api/order";
import dialog from "@/utils/dialog";
import { weappPay } from "@/libs/wechat";
import { _router } from '@/utils'
export function cancelOrderHandle(orderId) {
return new Promise((resolve, reject) => {
uni.showModal({
title: '提示',
content: '确认取消该订单?',
success(res) {
if (res.confirm) {
cancelOrder(orderId)
.then(res => {
uni.showToast({
title: '取消成功', icon: 'success', duration: 2000
});
resolve(res);
})
.catch(err => {
uni.showToast({
title: '取消失败', icon: 'none', duration: 2000
});
reject(err);
});
} else if (res.cancel) {
}
}
})
});
}
export function takeOrderHandle(orderId) {
return new Promise((resolve, reject) => {
takeOrder(orderId)
.then(res => {
uni.showToast({
title: '收货成功', icon: 'success', duration: 2000
});
resolve(res);
})
.catch(err => {
uni.showToast({
title: '收货失败', icon: 'none', duration: 2000
});
reject(err);
});
});
}
export function delOrderHandle(orderId) {
return new Promise((resolve, reject) => {
dialog.confirm({
mes: "确认删除该订单?",
opts() {
delOrder(orderId)
.then(res => {
uni.showToast({
title: '删除成功', icon: 'success', duration: 2000
});
resolve(res);
})
.catch(err => {
uni.showToast({
title: '删除失败', icon: 'none', duration: 2000
});
reject(err);
});
}
});
});
}
// 使用订单号进行支付
export function payOrderHandle(orderId, type, from) {
return new Promise((resolve, reject) => {
// dialog.loading.open("");
payOrder(orderId, type, from)
.then(res => {
handleOrderPayResults(res.data)
})
.catch(err => {
dialog.loading.close();
dialog.toast({ mes: err.msg || "订单支付失败" });
});
});
}
// 处理调用支付接口的逻辑
// @type create(创建订单)||pay(支付订单)
export function handleOrderPayResults(data, type) {
switch (data.status) {
// 订单号已存在
case "ORDER_EXIST":
// 取消支付
case "EXTEND_ORDER":
uni.showToast({
title: data.msg,
icon: "none",
duration: 2000,
});
goOrderDetails(data.result.orderId, type)
break;
case "PAY_DEFICIENCY":
break;
// 支付出错
case "PAY_ERROR":
uni.showToast({
title: data.msg,
icon: "none",
duration: 2000,
});
goOrderDetails(data.result.orderId, type)
break;
// 未传递支付环境
case "SUCCESS":
uni.showToast({
title: data.msg,
icon: "none",
duration: 2000,
});
goOrderDetails(data.result.orderId, type)
break;
// H5支付
case "WECHAT_H5_PAY":
goOrderDetails(data.result.orderId, type)
console.log(data)
setTimeout(() => {
// #ifdef H5
// "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx15171343713577e9f3a418b0865ef90000&package=2547890641"
// location.href = data.result.jsConfig.mweb_url;
// #endif
}, 100);
break;
// 小程序支付
case "WECHAT_PAY":
weappPay(data.result.jsConfig).finally(() => {
goOrderDetails(data.result.orderId, type)
});
break;
// APP支付
case "WECHAT_APP_PAY":
weappPay(data.result.jsConfig).finally(() => {
goOrderDetails(data.result.orderId, type)
});
break;
}
}
export function goOrderDetails(id, type) {
// 创建订单时跳转到详情
if (type == 'create') {
console.log(_router)
_router.replace({
path: "/pages/order/OrderDetails/index",
query: {
id
},
});
}
}