Browse Source

序列号卡控当前账号经销商,无客户档案提交时查询绑定

xiaohaizhao 2 months ago
parent
commit
e1910e3f6a
1 changed files with 59 additions and 5 deletions
  1. 59 5
      pages/workOrder/changeMsg.vue

+ 59 - 5
pages/workOrder/changeMsg.vue

@@ -156,7 +156,7 @@ let loading = ref(false);
 
 function save() {
     if (loading.value) return;
-    uFormRef.value.validate().then(valid => {
+    uFormRef.value.validate().then(async valid => {
         if (valid) {
             let content = {
                 "sa_workorderid": sa_workorderid,
@@ -169,6 +169,22 @@ function save() {
             content.name = content.customername || '';
             content.sa_customersid = content.sa_customersid == '' ? content.sa_customersid : 0;
             loading.value = true;
+            if (content.sa_customersid == 0 || content.sa_customersid == '') await $Http.basic({
+                "id": 2025121118401503,
+                "content": {
+                    "nocache": true,
+                    sys_enterpriseid: userInfo.sys_enterpriseid,
+                    "pageNumber": 1,
+                    "pageSize": 2, "where": { "phonenumber": content.scenecontactphonenumber }
+                }
+            }).then(res => {
+                console.log("查询客户信息", res)
+                if (res.code === 1 && res.data.length > 0) {
+                    content.sa_customersid = res.data[0].sa_customersid;
+                    content.customername = res.data[0].name;
+                    content.customerphonenumber = res.data[0].phonenumber;
+                }
+            });
             $Http.basic({
                 "id": "20230208140003",
                 content
@@ -282,12 +298,48 @@ function changeRegion(e) {
     form.county = e.detail.value[2];
 }
 
-function skuConfirm() {
-    if (sku.value) {
-        if (sku.value == '') return;
+let userInfo = reactive({
+    sys_enterpriseid: 0
+});
+$Http.basic({
+    "classname": "common.usercenter.usercenter",
+    "method": "queryUserMsg",
+    "content": {}
+}).then(res => {
+    console.log("用户信息", res);
+    if (res.code === 1) {
+        userInfo = reactive(res.data.agent);
+    }
+})
+
+async function skuConfirm() {
+    if (sku.value.trim()) {
+        if (sku.value.trim() == '') return;
+        let s = {
+            code: 1,
+        }
+        if (detail.initiator == '经销商') s = await $Http.basic({
+            id: 2025121515015903,
+            content: {
+                sys_enterpriseid: userInfo.sys_enterpriseid,
+                "sku": sku.value.trim()
+            }
+        })
+        if (s.code !== 1) {
+            uni.showModal({
+                title: '错误提示',
+                content: s.msg,
+                showCancel: false,
+                confirmText: '我知道了',
+            })
+            form.sku = '';
+            sku.value = '';
+            return
+        }
         $Http.basic({
             "id": 20221215101003,
-            "content": {
+            content: {
+                nocache: true,
                 "where": {
                     "sku": sku.value.trim()
                 }
@@ -323,6 +375,7 @@ function changeItem(item) {
     });
     uFormRef.value.clearValidate('sku');
 }
+
 function openScan() {
     uni.scanCode({
         onlyFromCamera: true,
@@ -342,6 +395,7 @@ function openScan() {
         }
     });
 }
+
 </script>
 
 <style lang="scss" scoped>