Jelajahi Sumber

change: indent转单流程调整.

peter 1 bulan lalu
induk
melakukan
cb8654cbb2

+ 8 - 0
src/api/indent.js

@@ -91,6 +91,14 @@ export const applySKU = (data) =>
     data,
   })
 
+// 根据id获取商品详情
+export const getProductDetailByID = (data) =>
+  request({
+    url: 'indent_product/details',
+    method: 'post',
+    data,
+  })
+
 // 创建引用报价数据
 export const cloneQuote = (data) =>
   request({

+ 108 - 4
src/pages/indent-manage/indent/components/skuApply.vue

@@ -28,6 +28,28 @@
         >
           <el-input v-model="form.product_name_cn"></el-input>
         </el-form-item>
+
+        <template v-if="id">
+          <el-form-item
+            label="材质"
+            prop="material"
+          >
+            <el-input v-model="form.material"></el-input>
+          </el-form-item>
+          <el-form-item
+            label="颜色"
+            prop="colour"
+          >
+            <el-input v-model="form.colour"></el-input>
+          </el-form-item>
+          <el-form-item
+            label="尺寸"
+            prop="size"
+          >
+            <el-input v-model="form.size"></el-input>
+          </el-form-item>
+        </template>
+
         <el-form-item
           prop=""
           label="产品图片"
@@ -77,7 +99,7 @@ import {
 import type { FormInstance } from 'element-plus'
 import { $t } from '@/i18n/index'
 import imageUpload from '@/components/ImageUpload.vue'
-import { applySKU } from '@/api/indent'
+import { applySKU, getProductDetailByID } from '@/api/indent'
 
 defineComponent({
   name: 'ComponentApplySku',
@@ -86,7 +108,15 @@ const show = ref(false)
 const loading = ref(false)
 const imageList = ref([])
 
-const { visible = false } = defineProps<{ visible: boolean }>()
+const {
+  visible = false,
+  id = '',
+  auditUser = '',
+} = defineProps<{
+  visible: boolean
+  id?: string
+  auditUser?: string
+}>()
 const $emit = defineEmits(['update:visible', 'apply'])
 
 const rules = {
@@ -104,19 +134,89 @@ const rules = {
       trigger: 'change',
     },
   ],
+  material: [
+    {
+      required: true,
+      message: $t('text_please_input'),
+      trigger: 'change',
+    },
+  ],
+  colour: [
+    {
+      required: true,
+      message: $t('text_please_input'),
+      trigger: 'change',
+    },
+  ],
+  size: [
+    {
+      required: true,
+      message: $t('text_please_input'),
+      trigger: 'change',
+    },
+  ],
 }
 watch(
   () => visible,
   () => {
     show.value = visible
     resetData()
+    if (id && visible) {
+      loading.value = true
+      getProductDetailByID({ id })
+        .then((response: any) => {
+          if (response.code === 1) {
+            const data = response.result
+            form.value.product_name = data.product_name
+            form.value.product_name_cn = data.product_name_cn
+            form.value.material = data.material
+            form.value.colour = data.colour
+            form.value.size = data.size
+            form.value.id = data.id
+            form.value.status = data.status
+            if (data.images) {
+              imageList.value = data.images.split(',').map((url: string) => {
+                return {
+                  url: url.startsWith('http')
+                    ? url
+                    : import.meta.env.VITE_APP_OSS_PREFIX + url,
+                }
+              })
+            }
+            const targetStatus = ['0', 0]
+            if (targetStatus.includes(data.status)) {
+              if (!data.colour || !data.size || !data.material) {
+                ElNotification({
+                  type: 'warning',
+                  title: '提示',
+                  message: `请完善SKU信息以方便审核`,
+                  duration: 6000,
+                })
+                return
+              }
+              ElNotification({
+                type: 'warning',
+                title: '提示',
+                message: `SKU已经在申请中, 正在等待: ${auditUser} 进行审批`,
+                duration: 6000,
+              })
+            }
+          }
+        })
+        .finally(() => {
+          loading.value = false
+        })
+    }
   },
 )
 const form = ref({
   product_name: '',
   product_name_cn: '',
   images: '',
-})
+  material: '',
+  colour: '',
+  size: '',
+} as any)
 const formRef = ref()
 const $mediaRegExp = inject('mediaRegExp') as RegExp
 
@@ -133,6 +233,7 @@ const checkForm = (formEl: FormInstance | undefined) => {
     loading.value = true
     applySKU(form.value)
       .then((response: any) => {
+        console.log(response, 'response')
         if (response.code === 1) {
           ElNotification({
             title: '操作成功',
@@ -140,7 +241,7 @@ const checkForm = (formEl: FormInstance | undefined) => {
             type: 'success',
             duration: 3000,
           })
-          $emit('apply', { product_name: form.value.product_name })
+          $emit('apply', { product_name: form.value.product_name, id: response.result })
           close()
         }
       })
@@ -154,6 +255,9 @@ const resetData = () => {
     product_name: '',
     product_name_cn: '',
     images: '',
+    material: '',
+    colour: '',
+    size: '',
   }
   imageList.value = []
 }

+ 1 - 1
src/pages/indent-manage/indent/components/skuSelect.vue

@@ -151,7 +151,7 @@ const onSkuApply = (data: any) => {
   $emit('select', {
     product_name: data.product_name,
     product_sku: '申请中',
-    id: '',
+    id: data.id,
   })
   close()
 }

+ 11 - 6
src/pages/indent-manage/indent/list.vue

@@ -446,6 +446,11 @@
       v-model:visible="dialogChangeOrderVisible"
       @success="onDialogChangeOrderClose"
     ></dialogQuoteRecord>
+    <sku-apply
+      :id="applySKUID"
+      :auditUser="auditUser"
+      v-model:visible="applySKUVisible"
+    ></sku-apply>
   </div>
 </template>
 
@@ -482,6 +487,7 @@ import freight from './components/freight.vue'
 import compEditInfo from './components/info.vue'
 import calcPrice from './components/calcPrice/index.vue'
 import dialogQuoteRecord from './components/quoteRecord.vue'
+import skuApply from './components/skuApply.vue'
 
 defineComponent({
   name: 'PageIndentList',
@@ -1008,15 +1014,14 @@ watch(bigImageVisible, () => {
 
 const changeOrderID = ref('')
 const dialogChangeOrderVisible = ref(false)
+const applySKUID = ref('') // 点转单反复展示申请sku弹窗
+const applySKUVisible = ref(false)
 const onBtnChangeOrderClick = (row: any, parentRow: any) => {
   // console.log(row, 'row', parentRow, 'parentRow')
   if (['Temporary Indent Product', '申请中'].includes(parentRow.product_sku)) {
-    ElNotification({
-      type: 'warning',
-      title: '提示',
-      message: `SKU在申请中无法直接转单, 需要联系: ${auditUser.value}`,
-      duration: 6000,
-    })
+    // 申请sku 弹窗
+    applySKUID.value = parentRow.item_id
+    applySKUVisible.value = true
   } else {
     if (parentRow.crm_so_id) {
       ElMessageBox.confirm(