diff --git a/.gitignore b/.gitignore
index fe6ddb6..ef7c482 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ package-lock.json
*.keystore
pnpm-lock.yaml
.history
+/AGENTS.md
diff --git a/components/card_orderBan/card_orderBan.vue b/components/card_orderBan/card_orderBan.vue
index 46ff90b..e084a92 100644
--- a/components/card_orderBan/card_orderBan.vue
+++ b/components/card_orderBan/card_orderBan.vue
@@ -1,222 +1,218 @@
-
-
-
-
-
-
+
+
+
+
- {{ item.name }}
-
-
-
-
+ class="btn size28 f500"
+ @click.stop="btnClick(item.id)"
+ :style="{ color: item.color, background: item.background, border: item.border }"
+ :class="{ btn1: props.type == 2 }"
+ >
+ {{ item.name }}
+
+
+
+
diff --git a/components/orderItem/AiOrderActionBar.vue b/components/orderItem/AiOrderActionBar.vue
index 220d890..3f9d0cc 100644
--- a/components/orderItem/AiOrderActionBar.vue
+++ b/components/orderItem/AiOrderActionBar.vue
@@ -14,7 +14,11 @@
>
立即发货
-
+
{{ props.viewText }}
@@ -23,6 +27,12 @@
去支付
+
+ 取消订单
+
+
+ 切换支付
+
@@ -46,5 +56,5 @@
},
});
- const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay']);
+ const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay', 'cancel']);
diff --git a/components/orderItem/card_order.vue b/components/orderItem/card_order.vue
index 1dcb7d0..e7ea4b3 100644
--- a/components/orderItem/card_order.vue
+++ b/components/orderItem/card_order.vue
@@ -1,168 +1,196 @@
-
+
+
+ {{ props.data.logisticsName }} {{ props.data.logisticsNo }}
+
+ 复制
+
+
+
-
- {{ props.data.logisticsName }} {{ props.data.logisticsNo }}
-
- 复制
-
-
-
-
-
-
-
-
-
-
-
- {{ v.spuName }}
-
- ¥{{ fen2yuan(v.price) }}
-
-
-
-
-
- {{ formatSkuProperties(item?.properties) }}
-
-
- x{{ item.count }}
- ¥{{ fen2yuan(item.price) }}
-
-
-
-
- ¥{{ fen2yuan(item.payPrice) }}
-
-
-
-
- {{ formatSkuProperties(v.properties) }}
- {{
+
+
+
+
+
+
+
+ {{ v.spuName }}
+
+ ¥{{ fen2yuan(v.price) }}
+
+
+
+
+
+ {{ formatSkuProperties(item?.properties) }}
+
+
+ x{{ item.count }}
+ ¥{{ fen2yuan(item.price) }}
+
+
+
+
+ ¥{{ fen2yuan(item.payPrice) }}
+
+
+
+
+ {{
+ formatSkuProperties(v.properties)
+ }}
+ {{
`x${v.count}`
}}
-
-
-
-
-
+ "
+ >
+ 申请售后
+
+
+ 取消售后
+
+ 售后成功
+
+
+
+
diff --git a/components/orderItem/orderItem.vue b/components/orderItem/orderItem.vue
index 517e66a..3025361 100644
--- a/components/orderItem/orderItem.vue
+++ b/components/orderItem/orderItem.vue
@@ -1,393 +1,433 @@
-
-
-
- 订单编号: {{ props.data.no }}
-
-
-
-
-
- {{ formatOrderStatus(props.data) }}
-
-
- {{ formatAfterSaleStatus(props.data) }}
-
-
-
-
-
-
-
-
-
- {{ props.data.spuName }}
-
- ¥{{ fen2yuan(props.data.refundPrice) }}
-
-
-
- {{
+
+
+
+ 订单编号: {{ props.data.no }}
+
+
+
+
+
+ {{ formatOrderStatus(props.data) }}
+
+
+ {{ formatAfterSaleStatus(props.data) }}
+
+
+
+
+
+
+
+
+
+ {{ props.data.spuName }}
+
+ ¥{{
+ fen2yuan(props.data.refundPrice)
+ }}
+
+
+
+ {{
props.data.properties.map((property) => property.valueName).join(' ')
}}
- {{ `x${props.data.count}` }}
-
-
- 取消售后
- {{ `x${props.data.count}` }}
+
+
+ 取消售后
+
- 填写物流信息
-
-
-
-
-
-
- !
-
- 延迟发货中,商品已为您锁定,配送需您手动恢复或点击立即发货。
-
-
- {{ formatCreateTime(props.data.createTime) }}
- 已优惠¥{{ fen2yuan(props.data.randomDiscountPrice) }}
-
-
- {{ `共${props.data.productCount}件商品 合计: `
- }}
-
- ¥{{ fen2yuan(props.data.payPrice) }}
-
-
-
-
-
-
-
-
-
+ "
+ >
+ 填写物流信息
+
+
+
+
+
+
+ !
+
+ 延迟发货中,商品已为您锁定,配送需您手动恢复或点击立即发货。
+
+
+ {{ formatCreateTime(props.data.createTime) }}
+ 已优惠¥{{ fen2yuan(props.data.randomDiscountPrice) }}
+
+
+ {{ `共${props.data.productCount}件商品 合计: ` }}
+
+ ¥{{
+ fen2yuan(props.data.payPrice)
+ }}
+
+
+
+
+
+
+
+
+
diff --git a/package.json b/package.json
index 1e00dc7..80298e0 100644
--- a/package.json
+++ b/package.json
@@ -103,6 +103,7 @@
},
"devDependencies": {
"prettier": "^2.8.7",
+ "sass": "^1.99.0",
"vconsole": "^3.15.0"
}
}
diff --git a/pages/AI/cashierDesk.vue b/pages/AI/cashierDesk.vue
index de1d802..5df935e 100644
--- a/pages/AI/cashierDesk.vue
+++ b/pages/AI/cashierDesk.vue
@@ -1,213 +1,259 @@
-
-
- ¥
- {{ fen2yuan(state.orderInfo.payPrice) }}
-
-
- 已优惠{{ fen2yuan(state.orderInfo.randomDiscountPrice) }}元
-
- {{ payDescText }}
-
-
-
-
-
+
+
+ ¥
+ {{ fen2yuan(state.orderInfo.payPrice) }}
+
+
+ 已优惠{{ fen2yuan(state.orderInfo.randomDiscountPrice) }}元
+
+ {{ payDescText }}
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/pages/AI/giftCashierDesk.vue b/pages/AI/giftCashierDesk.vue
index acb4ab1..81c6f45 100644
--- a/pages/AI/giftCashierDesk.vue
+++ b/pages/AI/giftCashierDesk.vue
@@ -60,6 +60,9 @@
支付已过期
+
+ 切换支付方式
+
item.value !== 'cash' || state.payStatus !== 3,
+ );
// 金额超出阈值,仅允许余额支付
if (state.orderInfo?.totalPrice >= SYSCONST.MAX_PRICE) {
state.payMethods = state.payMethods.map((item) => ({
@@ -148,6 +166,9 @@
if (state.payStatus === 2) {
return '该订单已支付';
}
+ if (state.payStatus === 3) {
+ return '现金待确认';
+ }
if (state.payStatus === 1 && state.orderInfo?.payExpireTime) {
const time = useDurationTime(state.orderInfo.payExpireTime);
if (time?.ms <= 0) {
@@ -184,6 +205,10 @@
state.payStatus = -1;
return;
}
+ if (Number(state.orderInfo.status) === 70) {
+ state.payStatus = 3;
+ return;
+ }
state.payStatus = 1; // 待支付
}
diff --git a/pages/AI/giftOrderInfo.vue b/pages/AI/giftOrderInfo.vue
index f346aba..7d903ba 100644
--- a/pages/AI/giftOrderInfo.vue
+++ b/pages/AI/giftOrderInfo.vue
@@ -73,7 +73,11 @@
-
+
下单时间
@@ -169,6 +173,12 @@
text: '已取消',
text1: '您的订单已取消!',
},
+ 70: {
+ text: '现金待确认',
+ text1: '等待工作人员确认收款',
+ btn1: '切换支付',
+ btn2: '取消订单',
+ },
});
// ========== 门店自提(核销) ==========
@@ -234,7 +244,14 @@
}
if (state.orderInfo.status === 0 && type === 2) {
// 取消订单
- cancelOrder();
+ cancelUnpaidOpenOrder();
+ }
+ if (Number(state.orderInfo.status) === 70 && type === 2) {
+ cancelOpenOrder();
+ }
+ if (Number(state.orderInfo.status) === 70 && type === 1) {
+ // 现金待确认切回线上支付
+ goPay();
}
if (state.orderInfo.status === 20 && type === 1) {
// 确认收货confirmReceive
@@ -253,8 +270,17 @@
payOrderId: state.orderInfo.payOrderId,
});
};
- const cancelOrder = () => {
- OrderApi.cancelOrder({
+ const cancelUnpaidOpenOrder = () => {
+ OrderApi.cancelUnpaidOpenOrder({
+ id: orderId.value,
+ }).then((res) => {
+ if (res.code === 0) {
+ getOrderDetail();
+ }
+ });
+ };
+ const cancelOpenOrder = () => {
+ OrderApi.cancelOpenOrder({
id: orderId.value,
}).then((res) => {
if (res.code === 0) {
diff --git a/pages/AI/orderInfo.vue b/pages/AI/orderInfo.vue
index c48644b..419ce5e 100644
--- a/pages/AI/orderInfo.vue
+++ b/pages/AI/orderInfo.vue
@@ -31,7 +31,7 @@
-
+
-
+
下单时间
@@ -103,8 +107,14 @@
@now="nowShipment"
@confirm="confirmReceiveOrder"
@pay="goPay"
+ @cancel="cancelAiOrder"
/>
-
+
@@ -114,10 +124,7 @@
import sheep from '@/sheep';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { computed, reactive, ref } from 'vue';
- import {
- fen2yuan,
- handleOrderButtons,
- } from '@/sheep/hooks/useGoods';
+ import { fen2yuan, handleOrderButtons } from '@/sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order';
import {
aiDelayedShipment,
@@ -126,11 +133,13 @@
giftConfirmReceive,
getOrderDetail as getAiOrderDetail,
getOpenOrderDetail,
+ cancelOrder as cancelAiOrderRequest,
+ cancelOpenOrder,
} from '@/sheep/api/ai';
import StoreApi from '@/sheep/api/trade/store';
import card_order from '@/components/orderItem/card_order.vue';
import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue';
- import truckLine from '@/components/truckLine/truckLine.vue'
+ import truckLine from '@/components/truckLine/truckLine.vue';
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
@@ -143,7 +152,6 @@
source: '',
});
-
// ========== 门店自提(核销) ==========
const systemStore = ref({}); // 门店信息
@@ -178,7 +186,7 @@
const status = Number(state.orderInfo?.status);
if ([0, 20].includes(status)) return true;
if (isPickUpOrder.value) return false;
- return [10, 50].includes(status);
+ return [10, 50, 70].includes(status);
});
const resolvePickUpStoreId = (data = {}) => {
@@ -256,9 +264,10 @@
const confirmReceiveOrder = async () => {
const id = resolveAiOrderId(state.orderInfo);
if (!id) return;
- const req = Number(state.orderInfo?.type) === 5 || String(state.orderType) === '5'
- ? giftConfirmReceive
- : aiConfirmReceive;
+ const req =
+ Number(state.orderInfo?.type) === 5 || String(state.orderType) === '5'
+ ? giftConfirmReceive
+ : aiConfirmReceive;
const { code } = await req({ id });
if (code === 0) {
getOrderDetail();
@@ -281,6 +290,25 @@
});
};
+ const cancelAiOrder = () => {
+ const id = resolveAiOrderId(state.orderInfo);
+ if (!id) return;
+ uni.showModal({
+ title: '提示',
+ content: '确定要取消订单吗?',
+ confirmColor: '#FA7E31',
+ success: async (res) => {
+ if (!res.confirm) return;
+ const request =
+ Number(state.orderInfo?.type) === 5 || String(state.orderType) === '5'
+ ? cancelOpenOrder
+ : cancelAiOrderRequest;
+ const result = await request({ id });
+ if (result.code === 0) await getOrderDetail();
+ },
+ });
+ };
+
async function getOrderDetail() {
let id = state.orderInfo.id;
// 对详情数据进行适配
@@ -350,7 +378,7 @@
type: 1,
},
{
- title: "随机优惠",
+ title: '随机优惠',
value: 'randomDiscountPrice',
type: 1,
},
diff --git a/pages/order/list.vue b/pages/order/list.vue
index bd21872..0319618 100644
--- a/pages/order/list.vue
+++ b/pages/order/list.vue
@@ -72,6 +72,7 @@
:data="v"
@downData="downCallback(state.currentTab)"
:index="state.currentTab"
+ :isAfterSale="tabMaps[state.currentTab].id === 4"
>
@@ -119,6 +120,11 @@
name: '待支付',
value: 0,
},
+ {
+ id: 70,
+ name: '现金待确认',
+ value: 70,
+ },
{
id: 10,
name: '待发货',
diff --git a/pages/pay/index.vue b/pages/pay/index.vue
index 27784c7..47f19d9 100644
--- a/pages/pay/index.vue
+++ b/pages/pay/index.vue
@@ -31,12 +31,7 @@
src="/static/pay/cod_disabled.png"
mode="aspectFit"
/>
-
+
{{ item.title }}
@@ -64,6 +59,9 @@
支付已过期
+
+ 切换支付方式
+
item.value !== 'cash' || state.payStatus !== 3,
+ );
console.log(state.payMethods);
state.payMethods.find((item) => {
console.log(item);
diff --git a/sheep/api/ai/index.ts b/sheep/api/ai/index.ts
index acdc531..4ec83df 100644
--- a/sheep/api/ai/index.ts
+++ b/sheep/api/ai/index.ts
@@ -1,19 +1,19 @@
-import request from '@/sheep/request'
+import request from '@/sheep/request';
// 消息列表 aishop/shop-messages/list
export function getMessageList(params: any) {
return request({
url: '/aishop/shop-messages/list',
method: 'get',
- params
- })
+ params,
+ });
}
// 是否开通店铺 member/user/check-shop-status
export function checkShopStatus(params: any) {
return request({
url: '/member/user/check-shop-status',
method: 'get',
- params
- })
+ params,
+ });
}
// 判断剩余开通数量 member/user/ai-shop-remaining
@@ -21,8 +21,8 @@ export function getRemainingCount(params: any) {
return request({
url: '/member/user/ai-shop-remaining',
method: 'get',
- params
- })
+ params,
+ });
}
// 选品广场 aishop/product/spu/page
@@ -30,16 +30,16 @@ export function getSpuPage(params: any) {
return request({
url: '/aishop/product/spu/page',
method: 'get',
- params
- })
+ params,
+ });
}
// 选品广场 轮次
export function getSpuTimeList(params: any) {
return request({
url: '/aishop/product/spu/time-list',
method: 'get',
- params
- })
+ params,
+ });
}
// 代理收益订单排行 aishop/agent-earnings-order/earnings-page
@@ -51,18 +51,18 @@ export function earningsPage(params: any) {
custom: {
showLoading: false,
},
- })
+ });
}
// 明细 aishop/product/spu/get-detail
export function getSpuDetail(id: any, shoppingPlazaId: any) {
return request({
url: '/aishop/product/spu/get-detail',
method: 'get',
- params:{
+ params: {
id,
- shoppingPlazaId
- }
- })
+ shoppingPlazaId,
+ },
+ });
}
// 添加购物车 app-api/aishop/shop-cart/add
@@ -73,17 +73,17 @@ export function addShopCart(params: any) {
data: params,
custom: {
showSuccess: true,
- successMsg: '添加成功'
+ successMsg: '添加成功',
},
- })
+ });
}
// 获取购物车列表app-api/aishop/shop-cart/list
export function getShopCartList(params: any) {
return request({
url: '/aishop/shop-cart/list',
method: 'get',
- params
- })
+ params,
+ });
}
// 删除购物车 app-api/aishop/shop-cart/delete
export function deleteShopCart(params: any) {
@@ -93,9 +93,9 @@ export function deleteShopCart(params: any) {
params,
custom: {
showSuccess: true,
- successMsg: '删除成功'
+ successMsg: '删除成功',
},
- })
+ });
}
// 更新购物车 app-api/aishop/shop-cart/update
export function updateShopCart(params: any) {
@@ -105,9 +105,9 @@ export function updateShopCart(params: any) {
data: params,
custom: {
showSuccess: true,
- successMsg: '更新成功'
+ successMsg: '更新成功',
},
- })
+ });
}
// 获取订单结算信息aishop/order/settlement
@@ -115,38 +115,38 @@ export function getSettlementInfo(params: any) {
return request({
url: '/aishop/order/settlement',
method: 'get',
- params
- })
+ params,
+ });
}
// 生成订单 aishop/order/createOrder
export function createOrder(params: any) {
const query = {
...params,
- }
+ };
if (!(Number(query?.id) > 0)) {
- delete query.id
+ delete query.id;
}
if (!(Number(query?.deliveryType) > 0)) {
- delete query.deliveryType
+ delete query.deliveryType;
}
if (!(Number(query?.pickUpStoreId) > 0)) {
- delete query.pickUpStoreId
+ delete query.pickUpStoreId;
}
if (!String(query?.receiverName || '').trim()) {
- delete query.receiverName
+ delete query.receiverName;
}
if (!String(query?.receiverPhone || query?.receiverMobile || '').trim()) {
- delete query.receiverPhone
+ delete query.receiverPhone;
} else {
- query.receiverPhone = String(query?.receiverPhone || query?.receiverMobile || '').trim()
+ query.receiverPhone = String(query?.receiverPhone || query?.receiverMobile || '').trim();
}
- delete query.receiverMobile
+ delete query.receiverMobile;
return request({
url: '/aishop/order/createOrder',
method: 'post',
params: query,
- })
+ });
}
//查询订单 aishop/order/get-detail
@@ -154,24 +154,24 @@ export function getOrderDetail(params: any) {
return request({
url: '/aishop/order/get-detail',
method: 'get',
- params
- })
+ params,
+ });
}
// 获取订单列表 aishop/order/page
export function getOrderPage(params: any) {
return request({
url: '/aishop/order/page',
method: 'get',
- params
- })
+ params,
+ });
}
// 店铺订单列表 aishop/order/aiShopPage
export function getAiShopPage(params: any) {
return request({
url: '/aishop/order/aiShopPage',
method: 'get',
- params
- })
+ params,
+ });
}
// 取消订单 aishop/order/cancel
@@ -182,9 +182,35 @@ export function cancelOrder(params: any) {
params,
custom: {
showSuccess: true,
- successMsg: '取消成功'
+ successMsg: '取消成功',
},
- })
+ });
+}
+
+// 取消现金待确认的 AI 店铺开通订单
+export function cancelOpenOrder(params: { id: number }) {
+ return request({
+ url: '/aishop/order/cancel-open',
+ method: 'DELETE',
+ params,
+ custom: {
+ showSuccess: true,
+ successMsg: '取消成功',
+ },
+ });
+}
+
+// 取消未支付的 AI 店铺开通订单
+export function cancelUnpaidOpenOrder(params: { id: number }) {
+ return request({
+ url: '/aishop/order/cancel-open-unpaid',
+ method: 'DELETE',
+ params,
+ custom: {
+ showSuccess: true,
+ successMsg: '取消成功',
+ },
+ });
}
// 确认收货 aishop/order/receive
export function confirmReceive(params: any) {
@@ -194,9 +220,9 @@ export function confirmReceive(params: any) {
params,
custom: {
showSuccess: true,
- successMsg: '确认收货成功'
+ successMsg: '确认收货成功',
},
- })
+ });
}
// 开通ai店铺aishop/order/createOpen
@@ -205,97 +231,97 @@ export function createOpen(params: any) {
url: '/aishop/order/createOpen',
method: 'post',
params,
- })
+ });
}
// 用户等级 aishop/level-card/info
export function getLevelInfo(params: any) {
return request({
url: '/aishop/level-card/info',
method: 'get',
- params
- })
+ params,
+ });
}
export function getPrice(params: any) {
return request({
url: '/app/markingConfig/getPrice',
method: 'get',
- params
- })
+ params,
+ });
}
// 获取是否开通商品发货
-export function getAiOpenStatus(params : any) {
- return request({
- url: '/aishop/shop-cart/AiOpenStatus',
- method: 'get',
- params
- })
+export function getAiOpenStatus(params: any) {
+ return request({
+ url: '/aishop/shop-cart/AiOpenStatus',
+ method: 'get',
+ params,
+ });
}
//获取已购买赠品
export function getGiftOrder(params: any) {
return request({
url: '/aishop/order/get-pay-order',
method: 'get',
- params
- })
+ params,
+ });
}
//查询赠品订单
-export function getGiftOrderDetail(params : any) {
- return request({
- url: '/aishop/order/get-detail-open',
- method: 'get',
- params
- })
+export function getGiftOrderDetail(params: any) {
+ return request({
+ url: '/aishop/order/get-detail-open',
+ method: 'get',
+ params,
+ });
}
export const getOpenOrderDetail = getGiftOrderDetail;
// 获取开通ai店铺商品订单结算信息
-export function getGiftSettlementInfo(params : any) {
- return request({
- url: '/aishop/order/settlement-open',
- method: 'get',
- params
- })
+export function getGiftSettlementInfo(params: any) {
+ return request({
+ url: '/aishop/order/settlement-open',
+ method: 'get',
+ params,
+ });
}
// 创建发货状态订单
-export function createOrderOpen(params : any) {
- const query = {
- ...params,
- }
- if (!(Number(query?.id) > 0)) {
- delete query.id
- }
- if (!(Number(query?.spuId) > 0)) {
- delete query.spuId
- }
- if (!(Number(query?.deliveryType) > 0)) {
- delete query.deliveryType
- }
- if (!(Number(query?.pickUpStoreId) > 0)) {
- delete query.pickUpStoreId
- }
- if (!String(query?.receiverName || '').trim()) {
- delete query.receiverName
- }
- if (!String(query?.receiverPhone || query?.receiverMobile || '').trim()) {
- delete query.receiverPhone
- } else {
- query.receiverPhone = String(query?.receiverPhone || query?.receiverMobile || '').trim()
- }
- delete query.receiverMobile
- return request({
- url: '/aishop/order/createOrderOpen',
- method: 'post',
- params: query,
- })
+export function createOrderOpen(params: any) {
+ const query = {
+ ...params,
+ };
+ if (!(Number(query?.id) > 0)) {
+ delete query.id;
+ }
+ if (!(Number(query?.spuId) > 0)) {
+ delete query.spuId;
+ }
+ if (!(Number(query?.deliveryType) > 0)) {
+ delete query.deliveryType;
+ }
+ if (!(Number(query?.pickUpStoreId) > 0)) {
+ delete query.pickUpStoreId;
+ }
+ if (!String(query?.receiverName || '').trim()) {
+ delete query.receiverName;
+ }
+ if (!String(query?.receiverPhone || query?.receiverMobile || '').trim()) {
+ delete query.receiverPhone;
+ } else {
+ query.receiverPhone = String(query?.receiverPhone || query?.receiverMobile || '').trim();
+ }
+ delete query.receiverMobile;
+ return request({
+ url: '/aishop/order/createOrderOpen',
+ method: 'post',
+ params: query,
+ });
}
-//查询赠品订单
+//查询赠品订单
export function getGiftOrderInfo(params: any) {
return request({
url: '/aishop/order/get-detail-open',
method: 'get',
- params
- })
+ params,
+ });
}
// 赠品确认收货
export function giftConfirmReceive(params: any) {
@@ -305,25 +331,25 @@ export function giftConfirmReceive(params: any) {
params,
custom: {
showSuccess: true,
- successMsg: '确认收货成功'
+ successMsg: '确认收货成功',
},
- })
+ });
}
//开通ai店铺赠送商品套餐
-export function getAiProduct(params : any) {
- return request({
- url: '/aishop/product/page',
- method: 'get',
- params
- })
+export function getAiProduct(params: any) {
+ return request({
+ url: '/aishop/product/page',
+ method: 'get',
+ params,
+ });
}
// 延迟发货
-export function aiDelayedShipment(params : any) {
- return request({
- url: '/aishop/order/update/delayedShipment',
- method: 'post',
- params,
- })
+export function aiDelayedShipment(params: any) {
+ return request({
+ url: '/aishop/order/update/delayedShipment',
+ method: 'post',
+ params,
+ });
}
export function getMyShop(params: any) {
@@ -331,14 +357,14 @@ export function getMyShop(params: any) {
url: '/aishop/app/myshop/get',
method: 'get',
params,
- })
+ });
}
// 立即发货
-export function aiPendingShipment(params : any) {
- return request({
- url: '/aishop/order/update/pendingShipment',
- method: 'post',
- params,
- })
+export function aiPendingShipment(params: any) {
+ return request({
+ url: '/aishop/order/update/pendingShipment',
+ method: 'post',
+ params,
+ });
}
diff --git a/sheep/hooks/useGoods.js b/sheep/hooks/useGoods.js
index 83c02c6..3f5d190 100644
--- a/sheep/hooks/useGoods.js
+++ b/sheep/hooks/useGoods.js
@@ -141,8 +141,8 @@ export function formatOrderStatus(order) {
if (order.status == 60) {
return '待处理';
}
- if (order.status == 70) {
- return '已下架';
+ if (Number(order.status) === 70) {
+ return '现金待确认';
}
return '已关闭';
}
@@ -156,6 +156,9 @@ export function formatOrderStatusDescription(order) {
if (order.status === 0) {
return `请在 ${formatDate(order.payExpireTime)} 前完成支付`;
}
+ if (Number(order.status) === 70) {
+ return '等待工作人员确认收款';
+ }
if (order.status === 10) {
return '商家未发货,请耐心等待';
}
@@ -195,6 +198,9 @@ export function handleOrderButtons(order) {
order.buttons.push('cancel');
order.buttons.push('pay');
}
+ if (Number(order.status) === 70) {
+ order.buttons.push('cancel');
+ }
if (order.status === 30 && !order.commentStatus) {
// 发起评价
order.buttons.push('comment');
diff --git a/sheep/platform/pay.js b/sheep/platform/pay.js
index cb0de11..2f133ce 100644
--- a/sheep/platform/pay.js
+++ b/sheep/platform/pay.js
@@ -108,7 +108,12 @@ export default class SheepPay {
},
},
};
- return payAction[sheep.$platform.name][this.payment]();
+ const action = payAction[sheep.$platform.name]?.[this.payment];
+ if (!action) {
+ sheep.$helper.toast('当前支付方式不可用');
+ return;
+ }
+ return action();
}
// 预支付
@@ -134,14 +139,13 @@ export default class SheepPay {
console.log('发起预支付 API 调用' + JSON.stringify(data));
// 发起预支付 API 调用
PayOrderApi.submitOrder(data).then((res) => {
- // 成功时
- res.code === 0 && resolve(res);
+ resolve(res);
// 失败时
- if (res.code !== 0 && res.msg.indexOf('无效的openid') >= 0) {
+ if (res.code !== 0 && res.msg?.indexOf('无效的openid') >= 0) {
// 特殊逻辑:微信公众号、小程序支付时,必须传入 openid 不正确的情况
if (
- res.msg.indexOf('无效的openid') >= 0 || // 获取的 openid 不正确时,或者随便输入了个 openid
- res.msg.indexOf('下单账号与支付账号不一致') >= 0
+ res.msg?.indexOf('无效的openid') >= 0 || // 获取的 openid 不正确时,或者随便输入了个 openid
+ res.msg?.indexOf('下单账号与支付账号不一致') >= 0
) {
// https://developers.weixin.qq.com/community/develop/doc/00008c53c347804beec82aed051c00
this.bindWeixin();
@@ -181,8 +185,9 @@ export default class SheepPay {
async wechatWapPay() {
const { error, data } = await this.prepay();
if (error === 0) {
- const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${this.payment
- }&orderType=${this.orderType}`;
+ const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${
+ this.payment
+ }&orderType=${this.orderType}`;
location.href = `${data.pay_data.h5_url}&redirect_url=${encodeURIComponent(redirect_url)}`;
}
}
@@ -234,8 +239,44 @@ export default class SheepPay {
}
async cashPay() {
- const { code } = await this.prepay('cash_payment');
- code === 0 && this.payResult('success');
+ const result = await this.prepay('cash_payment');
+ const code = result?.code;
+ const data = result?.data;
+ if (code !== 0) {
+ return;
+ }
+ if (Number(data?.status) !== 40 || data?.displayContent !== 'cash_pending') {
+ sheep.$helper.toast('现金支付状态异常');
+ return;
+ }
+ const payOrderResult = await PayOrderApi.getOrder(this.id, false);
+ const payOrder = payOrderResult?.code === 0 ? payOrderResult.data : null;
+ uni.showModal({
+ title: '现金支付',
+ content: '现金支付申请已提交,等待工作人员确认',
+ showCancel: false,
+ success: () => this.redirectCashPendingOrder(payOrder),
+ });
+ }
+
+ redirectCashPendingOrder(payOrder = {}) {
+ const businessOrderId = payOrder?.merchantOrderId;
+ const orderType = Number(payOrder?.orderType);
+ if (!businessOrderId) {
+ uni.reLaunch({ url: '/pages/order/list' });
+ return;
+ }
+ const routes = {
+ 1: `/pages/order/detail?id=${businessOrderId}`,
+ 2: `/pages/AI/orderInfo?id=${businessOrderId}`,
+ 3: `/pages/AI/giftOrderInfo?id=${businessOrderId}`,
+ };
+ const url = routes[orderType];
+ if (!url) {
+ uni.reLaunch({ url: '/pages/order/list' });
+ return;
+ }
+ uni.redirectTo({ url });
}
// 模拟支付
@@ -273,7 +314,7 @@ export default class SheepPay {
if (code !== 0) {
return;
}
- console.log(data.displayContent)
+ console.log(data.displayContent);
uni.requestPayment({
provider: 'alipay',
orderInfo: data.displayContent, // 直接使用返回的支付参数
@@ -349,29 +390,31 @@ export default class SheepPay {
console.log('token:' + uni.getStorageSync('token'));
console.log('orderId:' + that.id);
// #ifdef APP-PLUS
- plus.share.getServices(services => {
- const weixinService = services.find(service => service.id === 'weixin');
- if (weixinService) {
- weixinService.launchMiniProgram({
- // appid: 'wx23b0c321b5d74d63',
- id: 'gh_c69ddc78e1cd', // 替换为实际小程序原始ID
- type: 0, // 类型:// 版本:0-正式版 1-测试版 2-体验版
- path: 'pages/pkgD/pay?token=' + uni.getStorageSync('token') + '&orderId=' + that.id, // 可选跳转路径
- });
- } else {
- uni.showToast({ title: '未检测到微信客户端', icon: 'none' });
- }
- }, err => {
- console.error('获取服务失败:', err);
- });
+ plus.share.getServices(
+ (services) => {
+ const weixinService = services.find((service) => service.id === 'weixin');
+ if (weixinService) {
+ weixinService.launchMiniProgram({
+ // appid: 'wx23b0c321b5d74d63',
+ id: 'gh_c69ddc78e1cd', // 替换为实际小程序原始ID
+ type: 0, // 类型:// 版本:0-正式版 1-测试版 2-体验版
+ path: 'pages/pkgD/pay?token=' + uni.getStorageSync('token') + '&orderId=' + that.id, // 可选跳转路径
+ });
+ } else {
+ uni.showToast({ title: '未检测到微信客户端', icon: 'none' });
+ }
+ },
+ (err) => {
+ console.error('获取服务失败:', err);
+ },
+ );
// #endif
-
}
//检测code是否过期
verify_wechat_code(code) {
- let appid = 'wx23b0c321b5d74d63'
- let secret = 'aff28ef70e00c12245e77a9804dfd8a2'
- let url = `https://api.weixin.qq.com/sns/oauth2/access_token?appid=${appid}&secret=${secret}&code=${code}&grant_type=authorization_code`
+ let appid = 'wx23b0c321b5d74d63';
+ let secret = 'aff28ef70e00c12245e77a9804dfd8a2';
+ let url = `https://api.weixin.qq.com/sns/oauth2/access_token?appid=${appid}&secret=${secret}&code=${code}&grant_type=authorization_code`;
return uni.request({
url: url,
method: 'GET',
@@ -382,11 +425,10 @@ export default class SheepPay {
fail(err) {
console.log('verify_wechat_code 失败:' + JSON.stringify(err));
},
- })
+ });
}
//检测是否开通支付
is_open_wxPay(pay_info) {
-
uni.requestPayment({
provider: 'wxpay',
orderInfo: pay_info,
@@ -395,35 +437,36 @@ export default class SheepPay {
},
fail(err) {
console.error('开通支付失败:', err);
- }
+ },
});
}
// 汇付支付宝支付
async hfAlipayPay() {
let { code, data } = await this.prepay('hf_alipay_app');
- console.log(data)
- if (code !== 0) return
+ console.log(data);
+ if (code !== 0) return;
if (data.displayMode.toLowerCase() == sheep.$platform.name.toLowerCase()) {
//拼接支付宝内部功能,直接打开支付页面
- let url = `alipays://platformapi/startapp?saId=10000007&qrcode=${encodeURI(data.displayContent)}?_s=web-other`;
- console.log(url)
- let platform = uni.getSystemInfoSync().platform;//获取平台判断
+ let url = `alipays://platformapi/startapp?saId=10000007&qrcode=${encodeURI(
+ data.displayContent,
+ )}?_s=web-other`;
+ console.log(url);
+ let platform = uni.getSystemInfoSync().platform; //获取平台判断
if (platform == 'android') {
- plus.runtime.openURL(url)
+ plus.runtime.openURL(url);
} else if (platform == 'ios') {
plus.runtime.launchApplication({
- action: url
- })
+ action: url,
+ });
}
} else {
sheep.$helper.toast(`请使用${data.displayMode}进行支付`);
}
-
}
-
}
export function getPayMethods(channels) {
+ channels = Array.isArray(channels) ? channels : [];
const payMethods1 = [
{
icon: '/static/pay/wechat.svg',
@@ -470,10 +513,9 @@ export function getPayMethods(channels) {
{
icon: '/static/pay/alipay.svg',
title: 'H支付宝支付',
- value: "hf_alipay_app",
+ value: 'hf_alipay_app',
disabled: false,
},
-
];
let payMethods = [];
// 1. 处理【微信支付】
@@ -492,8 +534,7 @@ export function getPayMethods(channels) {
let hfAlipayMethod = null;
payMethods1.forEach((e) => {
const exists =
- channels.indexOf(e.value) !== -1 ||
- (e.value === 'cash' && channels.includes('cash_payment'));
+ channels.indexOf(e.value) !== -1 || (e.value === 'cash' && channels.includes('cash_payment'));
if (exists) {
payMethods.push(e);
if (e.value == 'wechat') {
@@ -520,7 +561,7 @@ export function getPayMethods(channels) {
(platform === 'WechatMiniProgram' && channels.includes('wx_lite')) ||
(platform === 'App' && channels.includes('wx_app'))
) {
- wechatMethod.disabled = false;
+ if (wechatMethod) wechatMethod.disabled = false;
}
if (
@@ -529,10 +570,10 @@ export function getPayMethods(channels) {
(platform === 'WechatMiniProgram' && channels.includes('alipay_wap')) ||
(platform === 'App' && channels.includes('alipay_app'))
) {
- alipayMethod.disabled = false;
+ if (alipayMethod) alipayMethod.disabled = false;
}
if (channels.includes('wallet')) {
- walletMethod.disabled = false;
+ if (walletMethod) walletMethod.disabled = false;
}
if (channels.includes('cash_payment') && cashMethod) {
cashMethod.disabled = false;
@@ -558,7 +599,7 @@ export function goPayResult(id, orderType, resultType) {
// });
uni.redirectTo({
url: '/pages/pay/result?id=' + id + '&orderType=' + orderType + '&payState=' + resultType,
- })
+ });
}
export function goBindWeixin() {