diff --git a/src/views/order/Detail.vue b/src/views/order/Detail.vue index 7f3171c..e7d432d 100644 --- a/src/views/order/Detail.vue +++ b/src/views/order/Detail.vue @@ -18,8 +18,16 @@ - -
+ +
+ +
+
@@ -110,9 +118,24 @@ {{ orderData.fadanpingtai === 1 ? '平台发单' : orderData.fadanpingtai === 2 ? '商家发单' : '未知' }} + + {{ orderData.club_name || orderData.club_id }} + ¥{{ formatPrice(orderData.jiage) }} + + 会员 {{ orderData.huiyuan_id || '--' }} + 押金 ¥{{ formatPrice(orderData.yajin) }} + -- + 修改 + ¥{{ formatPrice(orderData.dashou_fencheng) }} @@ -240,14 +263,28 @@ - - + + -
{{ orderData.tkly || orderData.tuikuan_liyou }}
+
+ {{ orderData.tkly || orderData.tuikuan_liyou }} +
+
+ +
@@ -349,6 +386,28 @@ + + + + + + + 会员 + 押金 + + + + + + + + + + +
@@ -360,6 +419,7 @@ import { ElMessage } from 'element-plus' // 合并所有图标导入 import { Refresh, Money, CircleClose, Remove, Switch, Close, Warning, CircleCheck } from '@element-plus/icons-vue' import request from '@/utils/request' +import { getMenuAccess, hasPermCode } from '@/utils/club-context' const { proxy } = getCurrentInstance() const route = useRoute() @@ -367,6 +427,7 @@ const router = useRouter() const loading = ref(false) const operating = ref(false) +const canEditGrabReqBase = ref(false) const dingdanId = ref('') const username = ref(localStorage.getItem('username') || '') @@ -390,14 +451,16 @@ const orderData = ref({ clkf: '', chuangjianshijian: '', genggaishijian: '', + yaoqiuleixing: null, + huiyuan_id: '', + yajin: null, pingtai_kuozhan: null, shangjia_kuozhan: null, tuikuan_liyou: '' }) const dashouImages = ref([]) - -const dashouImagesFull = computed(() => dashouImages.value.map(url => getFullImageUrl(url))) +const refundImages = ref([]) const getFullImageUrl = (url) => { if (!url) return '' @@ -405,6 +468,9 @@ const getFullImageUrl = (url) => { return url.startsWith('http') ? url : ossUrl + url } +const dashouImagesFull = computed(() => dashouImages.value.map(url => getFullImageUrl(url))) +const refundImagesFull = computed(() => refundImages.value.map(url => getFullImageUrl(url))) + const formatPrice = (val) => parseFloat(val || 0).toFixed(2) const formatRemainText = (sec) => { @@ -449,6 +515,18 @@ const showActionButtons = computed(() => { return [1,2,4,7,8].includes(s) }) +/** 本店可处理;跨店只读(后端 can_mutate) */ +const canMutateOrder = computed(() => { + const v = orderData.value?.can_mutate + return v === undefined || v === null ? true : !!v +}) + +const canEditGrabReq = computed(() => { + if (!canEditGrabReqBase.value || !canMutateOrder.value) return false + if (Number(orderData.value.fadanpingtai) !== 1) return false + return [1, 7].includes(Number(orderData.value.zhuangtai)) +}) + const copyText = (text) => { navigator.clipboard.writeText(text).then(() => { ElMessage.success('复制成功') @@ -465,15 +543,62 @@ const refundDialogVisible = ref(false) const jjtkDialogVisible = ref(false) const jjjsDialogVisible = ref(false) const punishDialogVisible = ref(false) +const grabDialogVisible = ref(false) const newDashouId = ref('') const tuikuanLiyou = ref('') const jujueLiyou = ref('') const jjjsLiyou = ref('') const punishReason = ref('') +const grabForm = ref({ + yaoqiuleixing: 1, + huiyuan_id: '', + yongjin: 0, +}) const refundDialogTitle = computed(() => orderData.value.zhuangtai === 4 ? '同意退款' : '立即退款') +const openGrabDialog = () => { + grabForm.value = { + yaoqiuleixing: Number(orderData.value.yaoqiuleixing) === 2 ? 2 : 1, + huiyuan_id: orderData.value.huiyuan_id || '', + yongjin: orderData.value.yajin != null ? Number(orderData.value.yajin) : 0, + } + grabDialogVisible.value = true +} + +const submitGrabReq = async () => { + if (grabForm.value.yaoqiuleixing === 1 && !String(grabForm.value.huiyuan_id || '').trim()) { + ElMessage.warning('请填写会员ID') + return + } + operating.value = true + try { + const payload = { + phone: username.value, + dingdan_id: dingdanId.value, + yaoqiuleixing: grabForm.value.yaoqiuleixing, + } + if (grabForm.value.yaoqiuleixing === 1) { + payload.huiyuan_id = String(grabForm.value.huiyuan_id).trim() + } else { + payload.yongjin = grabForm.value.yongjin + } + const res = await request.post('/yonghu/kefu_gai_qiangdan_yaoqiu', payload) + if (res.code === 0) { + ElMessage.success(res.msg || '修改成功') + grabDialogVisible.value = false + fetchDetail() + } else { + ElMessage.error(res.msg || '修改失败') + } + } catch { + ElMessage.error('修改失败') + } finally { + operating.value = false + } +} + const fetchDetail = async () => { if (!dingdanId.value) return loading.value = true @@ -485,6 +610,7 @@ const fetchDetail = async () => { if (res.code === 0) { orderData.value = res.data dashouImages.value = res.data.dashou_images || [] + refundImages.value = res.data.tuikuan_tupian || [] } else { ElMessage.error(res.msg || '获取订单详情失败') } @@ -735,6 +861,7 @@ const showJjtkDialog = () => { jjtkDialogVisible.value = true; jujueLiyou.value const showJjjsDialog = () => { jjjsDialogVisible.value = true; jjjsLiyou.value = '' } onMounted(() => { + canEditGrabReqBase.value = hasPermCode(getMenuAccess(), '002ad') dingdanId.value = route.params.id if (!dingdanId.value) { ElMessage.error('订单ID不存在') diff --git a/src/views/order/PlatformOrder.vue b/src/views/order/PlatformOrder.vue index 374e591..956c74e 100644 --- a/src/views/order/PlatformOrder.vue +++ b/src/views/order/PlatformOrder.vue @@ -104,6 +104,9 @@ + + + @@ -111,6 +114,13 @@ + + + - + @@ -145,6 +161,46 @@ @current-change="handlePageChange" /> + + + + + + {{ orderGrabForm.dingdan_id }} + + + + 会员 + 押金 + + + + + + + + + + + + + + @@ -162,6 +218,17 @@ const route = useRoute() const router = useRouter() const loading = ref(false) const hasPermission = ref(false) +const canEditGrabReq = ref(false) +const grabSubmitting = ref(false) +const memberList = ref([]) + +const orderGrabVisible = ref(false) +const orderGrabForm = reactive({ + dingdan_id: '', + yaoqiuleixing: 1, + huiyuan_id: '', + yongjin: 0, +}) const PAGE_SIZE = 20 const pageNum = ref(1) @@ -393,8 +460,68 @@ const getStatusType = (code) => { watch(() => route.query, () => { restoreFromQuery(); fetchOrders() }, { deep: true }) +const loadMemberList = async () => { + try { + const res = await request.post('/houtai/hthqsplxzq', { + username: localStorage.getItem('username'), + }, { skipErrorToast: true }) + if (res.code === 0) { + memberList.value = res.data?.member_list || [] + } + } catch { + memberList.value = [] + } +} + +const openOrderGrabDialog = (row) => { + orderGrabForm.dingdan_id = row.dingdan_id + orderGrabForm.yaoqiuleixing = Number(row.yaoqiuleixing) === 2 ? 2 : 1 + orderGrabForm.huiyuan_id = row.huiyuan_id || '' + orderGrabForm.yongjin = row.yajin != null ? Number(row.yajin) : 0 + orderGrabVisible.value = true + if (!memberList.value.length) loadMemberList() +} + +const submitOrderGrab = async () => { + if (orderGrabForm.yaoqiuleixing === 1 && !String(orderGrabForm.huiyuan_id || '').trim()) { + ElMessage.warning('请填写会员ID') + return + } + if (orderGrabForm.yaoqiuleixing === 2 && (orderGrabForm.yongjin === null || orderGrabForm.yongjin === '')) { + ElMessage.warning('请填写押金金额') + return + } + grabSubmitting.value = true + try { + const payload = { + phone: localStorage.getItem('username'), + dingdan_id: orderGrabForm.dingdan_id, + yaoqiuleixing: orderGrabForm.yaoqiuleixing, + } + if (orderGrabForm.yaoqiuleixing === 1) { + payload.huiyuan_id = String(orderGrabForm.huiyuan_id).trim() + } else { + payload.yongjin = orderGrabForm.yongjin + } + const res = await request.post('/yonghu/kefu_gai_qiangdan_yaoqiu', payload) + if (res.code === 0) { + ElMessage.success(res.msg || '修改成功') + orderGrabVisible.value = false + fetchOrders() + } else { + ElMessage.error(res.msg || '修改失败') + } + } catch { + ElMessage.error('修改失败') + } finally { + grabSubmitting.value = false + } +} + onMounted(() => { - hasPermission.value = hasPermCode(getMenuAccess(), '002ab') + const access = getMenuAccess() + hasPermission.value = hasPermCode(access, '002ab') + canEditGrabReq.value = hasPermCode(access, '002ad') if (!hasPermission.value) return restoreFromQuery() fetchOrderTypes() diff --git a/src/views/product/List.vue b/src/views/product/List.vue index 3d5533e..a9c60cb 100644 --- a/src/views/product/List.vue +++ b/src/views/product/List.vue @@ -29,7 +29,15 @@
- 添加商品 +
+ 添加商品 + 批量改抢单要求 +
显示审核专用 @@ -282,13 +290,71 @@ 确认发布 + + + + + + + + + + + + + 会员 + 押金 + + + + + + + + + + + + +
将影响 {{ batchGrabPreview.affected_count }} 个商品(俱乐部 {{ batchGrabPreview.club_id }})
+
+
+ +
@@ -876,6 +1040,12 @@ onMounted(() => { align-items: center; margin-bottom: 20px; } +.action-left { + display: flex; + gap: 12px; + align-items: center; + flex-wrap: wrap; +} .audit-switch { display: flex; align-items: center;