Quellcode durchsuchen

Merge remote-tracking branch 'origin/main' into main

EvilDragon vor 3 Monaten
Ursprung
Commit
77cada79a8

+ 39 - 14
packages/merchant/src/pages/agent/components/task-card.vue

@@ -25,24 +25,49 @@ const status = ref<{ [key: number]: { title: string; bg: string; bgClass: string
   6: { title: '待确认', bg: '', bgClass: 'bg-[#f04c47]' },
 })
 const acceptingOrders = async (item: AgentTask) => {
-  await uni.showLoading()
-  const res = await taskReceive({
-    brokerId: userInfo.value.userId,
-    taskId: item.id,
-    isOrders: true,
+  uni.showModal({
+    title: '提示',
+    content: '是否确认接受该任务?',
+    showCancel: true,
+    cancelText: '取消',
+    confirmText: '确定',
+    success: async function (res) {
+      if (res.confirm) {
+        await uni.showLoading()
+        const res = await taskReceive({
+          brokerId: userInfo.value.userId,
+          taskId: item.id,
+          isOrders: true,
+        })
+        uni.hideLoading()
+        emits('change')
+      } else if (res.cancel) {
+      }
+    },
   })
-  uni.hideLoading()
-  emits('change')
 }
 const acceptingNoOrders = async (item: AgentTask) => {
-  await uni.showLoading()
-  const res = await taskReceive({
-    brokerId: userInfo.value.userId,
-    taskId: item.id,
-    isOrders: false,
+  uni.showModal({
+    title: '提示',
+    content: '是否确认不接该任务?',
+    showCancel: true,
+    cancelText: '取消',
+    confirmText: '确定',
+    success: async function (res) {
+      if (res.confirm) {
+        await uni.showLoading()
+        const res = await taskReceive({
+          brokerId: userInfo.value.userId,
+          taskId: item.id,
+          isOrders: false,
+        })
+        uni.hideLoading()
+        emits('change')
+      } else if (res.cancel) {
+        /* empty */
+      }
+    },
   })
-  uni.hideLoading()
-  emits('change')
 }
 const toDetail = () =>
   uni.navigateTo({ url: `/pages/agent/tasks/detail/index?taskId=${props.options.id}` })

+ 38 - 14
packages/merchant/src/pages/agent/tasks/detail/index.vue

@@ -74,24 +74,48 @@ const submitTask = async () => {
   publishState.value = false
 }
 const acceptingOrders = async () => {
-  await uni.showLoading()
-  const res = await taskReceive({
-    brokerId: userInfo.value.userId,
-    taskId: taskDetails.value.id,
-    orders: true,
+  uni.showModal({
+    title: '提示',
+    content: '是否确认接受该任务?',
+    showCancel: true,
+    cancelText: '取消',
+    confirmText: '确定',
+    success: async function (res) {
+      if (res.confirm) {
+        await uni.showLoading()
+        const res = await taskReceive({
+          brokerId: userInfo.value.userId,
+          taskId: taskDetails.value.id,
+          orders: true,
+        })
+        uni.hideLoading()
+        await initData()
+      } else if (res.cancel) {
+      }
+    },
   })
-  uni.hideLoading()
-  await initData()
 }
 const acceptingNoOrders = async () => {
-  await uni.showLoading()
-  const res = await taskReceive({
-    brokerId: userInfo.value.userId,
-    taskId: taskDetails.value.id,
-    orders: false,
+  uni.showModal({
+    title: '提示',
+    content: '是否确认不接该任务?',
+    showCancel: true,
+    cancelText: '取消',
+    confirmText: '确定',
+    success: async function (res) {
+      if (res.confirm) {
+        await uni.showLoading()
+        const res = await taskReceive({
+          brokerId: userInfo.value.userId,
+          taskId: taskDetails.value.id,
+          orders: false,
+        })
+        uni.hideLoading()
+        await initData()
+      } else if (res.cancel) {
+      }
+    },
   })
-  uni.hideLoading()
-  await initData()
 }
 onLoad(async (query?: Record<string | 'taskId', string>) => {
   taskId.value = query?.taskId