Browse Source

接单弹框

Jake 3 months ago
parent
commit
b8468607bd
1 changed files with 41 additions and 7 deletions
  1. 41 7
      packages/merchant/src/pages/agent/components/task-card.vue

+ 41 - 7
packages/merchant/src/pages/agent/components/task-card.vue

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