|
|
@@ -184,7 +184,7 @@ const form = reactive({
|
|
|
address: '', // 详细地址
|
|
|
remarks: '',
|
|
|
sa_customersid: WuserRecord.value.sa_customersid || 0,
|
|
|
- sys_enterpriseid: WuserRecord.value.sys_enterpriseid || 0,
|
|
|
+ sys_enterpriseid: 0,
|
|
|
});
|
|
|
|
|
|
const rules = reactive({
|
|
|
@@ -254,7 +254,7 @@ function save() {
|
|
|
form.name = form.customername;
|
|
|
form.phonenumber = form.scenecontactphonenumber;
|
|
|
form.sa_customersid = form.sa_customersid || 0;
|
|
|
- form.sys_enterpriseid = form.sys_enterpriseid || 0;
|
|
|
+ form.sys_enterpriseid = form.sys_enterpriseid || WuserRecord.value.sys_enterpriseid || 0;
|
|
|
let content = {
|
|
|
...form,
|
|
|
};
|
|
|
@@ -346,14 +346,28 @@ function onselectSku(item) {
|
|
|
item.contact = item.name;
|
|
|
item.serviceenterprisename = item.serviceenterprisename || item.enterprisename;
|
|
|
['customername', 'customerphonenumber', 'cardno', 'itemid', 'model', 'itemname', 'itemno', 'sa_customersid', 'sys_enterpriseid'].forEach(key => {
|
|
|
- if (key == 'sa_customersid' && (item.sa_customersid == 0 || item.sa_customersid == '')) {
|
|
|
- } else {
|
|
|
- form[key] = item[key] || '';
|
|
|
- }
|
|
|
+ form[key] = item[key] || '';
|
|
|
});
|
|
|
uni.showToast({ title: '成功带入产品信息', icon: 'none' });
|
|
|
querySku.value = true;
|
|
|
closePopup();
|
|
|
+ if (item.sa_agentsid) {
|
|
|
+ $Http.basic({
|
|
|
+ "classname": "webmanage.sale.agents.agents",
|
|
|
+ "method": "query_agentMain",
|
|
|
+ "content": { "nocache": true, "sa_agentsid": item.sa_agentsid },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("经销商档案id", res)
|
|
|
+ if (res.code !== 1) return;
|
|
|
+ if (res.data.type == '网销') {
|
|
|
+ form.isonlinesales = 1;
|
|
|
+ } else {
|
|
|
+ form.isonlinesales = 0;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ form.isonlinesales = 0;
|
|
|
+ }
|
|
|
}
|
|
|
let products = ref([]); // 产品列表
|
|
|
function closePopup() {
|
|
|
@@ -390,84 +404,6 @@ function validatePhoneNumber(value) {
|
|
|
return telReg.test(cleanedTel);
|
|
|
}
|
|
|
|
|
|
-function phonenumberConfirm() {
|
|
|
- if (!validatePhoneNumber(form.customerphonenumber)) return wx.showToast({
|
|
|
- title: '手机号不符合规格',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- $Http.basic({
|
|
|
- "id": 2025090809202003,
|
|
|
- "content": {
|
|
|
- "pageNumber": 1,
|
|
|
- "pageSize": 50,
|
|
|
- "where": {
|
|
|
- phonenumber: form.customerphonenumber,
|
|
|
- }
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- uni.hideLoading();
|
|
|
- console.log("根据用户手机查询客户档案", res)
|
|
|
- if (res.code !== 1) {
|
|
|
- phonenumberConfirmSku()
|
|
|
- return;
|
|
|
- }
|
|
|
- if (res.data.length === 0) {
|
|
|
- phonenumberConfirmSku()
|
|
|
- return;
|
|
|
- }
|
|
|
- let item = res.data[0];
|
|
|
- item.customername = item.name;
|
|
|
- item.customerphonenumber = item.phonenumber;
|
|
|
- ['customername', 'customerphonenumber', 'sa_customersid'].forEach(key => {
|
|
|
- if (key == 'sa_customersid' && (item.sa_customersid == 0 || item.sa_customersid == '')) {
|
|
|
- } else {
|
|
|
- form[key] = item[key] || '';
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-function phonenumberConfirmSku() {
|
|
|
- $Http.basic({
|
|
|
- "id": 2025080813465203,
|
|
|
- "content": {
|
|
|
- "pageNumber": 1,
|
|
|
- "pageSize": 50,
|
|
|
- "where": {
|
|
|
- phonenumber: form.customerphonenumber,
|
|
|
- }
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("根据用户手机查询SKU", res)
|
|
|
- if (res.code !== 1) return uni.showToast({ title: res.msg, icon: 'none' });
|
|
|
- if (res.data.length === 0) return wx.showModal({
|
|
|
- content: '未找到购买人信息,请确认序列号或手机号是否正确,如有疑问请联系购买单位。',
|
|
|
- title: '提示',
|
|
|
- showCancel: false,
|
|
|
- })
|
|
|
- let item = res.data[0];
|
|
|
- ['customername', 'customerphonenumber', 'sa_customersid', 'sys_enterpriseid'].forEach(key => {
|
|
|
- if (key == 'sa_customersid' && (item.sa_customersid == 0 || item.sa_customersid == '')) {
|
|
|
- } else {
|
|
|
- form[key] = item[key] || '';
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-//去选择产品
|
|
|
-function toSelectProduct() {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/select/product?topclassnum=' + form.class1
|
|
|
- });
|
|
|
- $Http.onSelected = (item) => {
|
|
|
- ['contact', 'serviceenterprisename', 'sku', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'phonenumber', 'unitname', 'spec'].forEach(key => {
|
|
|
- form[key] = item[key] || '';
|
|
|
- });
|
|
|
- uni.navigateBack()
|
|
|
- delete $Http.onSelected
|
|
|
- }
|
|
|
-}
|
|
|
let myProducts = ref([]); // 我的产品列表
|
|
|
if (WuserRecord.value.sa_customersid) $Http.basic({
|
|
|
id: 2025082115363003,
|