Selaa lähdekoodia

feat: indent转单后判断报价供应商状态.无id跳转供应商申请页面.

peter 1 kuukausi sitten
vanhempi
commit
78dd4e8343
2 muutettua tiedostoa jossa 48 lisäystä ja 0 poistoa
  1. 6 0
      src/api/user.js
  2. 42 0
      src/pages/indent-manage/indent/components/quoteRecord.vue

+ 6 - 0
src/api/user.js

@@ -16,6 +16,12 @@ export default {
   getUserDetail: (params) =>
     request({
       url: `/indent_admin/detail/`,
+      method: 'GET',
+      params,
+    }),
+  getUserDetailByName: (params) =>
+    request({
+      url: `/indent_admin/namedetail`,
       method: 'POST',
       data: params,
     }),

+ 42 - 0
src/pages/indent-manage/indent/components/quoteRecord.vue

@@ -230,6 +230,7 @@
                 >
                   提交
                 </el-button>
+                <!-- <el-button @click="toApplyVendor">test</el-button> -->
               </div>
             </el-form>
           </template>
@@ -370,7 +371,9 @@ import {
   ElIcon,
 } from 'element-plus'
 import { Notebook } from '@element-plus/icons-vue'
+import Cookie from 'js-cookie'
 import { getCalcPriceRecord, generateOrder } from '@/api/indent'
+import userAPI from '@/api/user'
 import skuSelect from './skuSelect.vue'
 
 defineComponent({
@@ -391,6 +394,30 @@ let show2 = ref(false)
 let loading = ref(false)
 let list = ref([] as any[])
 // let remoteOption = ref([])
+let user: any = ref({} as any)
+const getUserDetailFunc = () => {
+  let indentID = Cookie.get('indent-id') || ''
+  let indentName = Cookie.get('indent-user') || ''
+  console.log(indentID, 'indentID')
+  console.log(indentName, 'indentName')
+  // 由于历史原因, 早期登录时没有记录下用户id, 只有用户名称.
+  if (indentID) {
+    userAPI.getUserDetail({ id: indentID }).then((res: any) => {
+      if (res.code === 1) {
+        user.value = res.result || {}
+        console.log(res.result, 'res')
+      }
+    })
+  } else if (indentName) {
+    // get user by name
+    userAPI.getUserDetailByName({ username: indentName }).then((res: any) => {
+      if (res.code === 1) {
+        user.value = res.result || {}
+        console.log(res.result, 'res')
+      }
+    })
+  }
+}
 
 watch(
   () => visible,
@@ -398,6 +425,7 @@ watch(
     show.value = visible
     if (show.value) {
       getCalcPriceRecordFunc()
+      getUserDetailFunc()
     }
   },
 )
@@ -510,6 +538,19 @@ const submitChangeOrder = (index: number) => {
     onChangeOrderClick(data)
   })
 }
+// 跳转到申请录入供应商的外部页面.
+const toApplyVendor = () => {
+  // 找出当前转单的记录. 必定存在, 不然进不来这个组件.
+  let a = indentData.lists.filter((i: any) => i.id === id)
+  let tt = a[0] || {}
+  console.log(tt, 'tt')
+  // 为空或者不是纯数字, 说明这个id不是真的在crm的供应商id
+  if ([null, 'null', ''].includes(tt.vendor_id) || !/\d+/.test(tt.vendor_id)) {
+    window.open(
+      `https://forms.zohopublic.com/promocollectionau/form/SupplierCreationRequirements/formperma/ArflvTSXGDW--ONLT9Wgo5t0N1XLRJ8wGErjacQZl5g?email=${user.value.email || ''}&vendor=${encodeURIComponent(tt.vendor_name)}&name=${encodeURIComponent(tt.vendor_contact)}&phone=${tt.vendor_phone}`,
+    )
+  }
+}
 const onChangeOrderClick = (row: any) => {
   ElMessageBox.confirm('选择该条计价记录进行转单, 是否继续?', '提示', {
     confirmButtonText: '确定',
@@ -535,6 +576,7 @@ const onChangeOrderClick = (row: any) => {
                 `${id}` +
                 import.meta.env.VITE_SO_APPEND,
             )
+            toApplyVendor()
           }
         } else {
           ElNotification({