xiaohaizhao 5 mesi fa
parent
commit
caf1eb0c8d

+ 93 - 117
pages/bookingService/index.vue

@@ -23,11 +23,9 @@
 
 
             <up-form-item v-if="rules.class2[0].required" label="故障类型" :required="rules.class2[0].required"
             <up-form-item v-if="rules.class2[0].required" label="故障类型" :required="rules.class2[0].required"
                 prop="class2">
                 prop="class2">
-                <up-radio-group v-model="form.class2">
-                    <up-radio :customStyle="{ marginLeft: '12px' }" v-for="(item) in class2" :key="item.value"
-                        :label="item.value" :name="item.value">
-                    </up-radio>
-                </up-radio-group>
+                <picker class="picker" mode="selector" :range="class2" range-key="value" @change="changeClass2">
+                    {{ form.class2 || '请选择故障类型' }}
+                </picker>
             </up-form-item>
             </up-form-item>
 
 
             <view class="title">
             <view class="title">
@@ -38,9 +36,9 @@
                 <up-input v-model="form.sku" placeholder="序列号" clearable @blur="skuConfirm">
                 <up-input v-model="form.sku" placeholder="序列号" clearable @blur="skuConfirm">
                     <template #suffix>
                     <template #suffix>
                         <view style="display: flex;align-items: center;">
                         <view style="display: flex;align-items: center;">
-                            <view v-if="form.servicetype && form.servicetype != '安装'" class="my-but"
-                                hover-class="navigator-hover" @click="toSelectProduct2">
-                                选择产品
+                            <view v-if="form.servicetype && form.servicetype != '安装' && WuserRecord.sa_customersid"
+                                class="my-but" hover-class="navigator-hover" @click="toSelectMyProduct">
+                                选择我的产品
                             </view>
                             </view>
                             <up-icon name="scan" color="#2979ff" size="28" @click="openScan" />
                             <up-icon name="scan" color="#2979ff" size="28" @click="openScan" />
                         </view>
                         </view>
@@ -52,7 +50,8 @@
                 <up-input v-model="form.itemname" disabled placeholder="请输入序列号或选择产品">
                 <up-input v-model="form.itemname" disabled placeholder="请输入序列号或选择产品">
                     <template #suffix>
                     <template #suffix>
                         <view style="display: flex;align-items: center;">
                         <view style="display: flex;align-items: center;">
-                            <view class="my-but" hover-class="navigator-hover" @click="toSelectProduct">
+                            <view v-if="!rules.sku[0].required && !form.sku && form.class1" class="my-but"
+                                hover-class="navigator-hover" @click="toSelectProduct">
                                 选择产品
                                 选择产品
                             </view>
                             </view>
                         </view>
                         </view>
@@ -60,16 +59,9 @@
                 </up-input>
                 </up-input>
             </up-form-item>
             </up-form-item>
 
 
-            <up-form-item label="产品编号" prop="itemno">
-                <up-input v-model="form.itemno" disabled placeholder="请输入序列号或选择产品" />
-            </up-form-item>
-
             <up-form-item label="产品型号" prop="model">
             <up-form-item label="产品型号" prop="model">
                 <up-input v-model="form.model" disabled placeholder="请输入序列号或选择产品" />
                 <up-input v-model="form.model" disabled placeholder="请输入序列号或选择产品" />
             </up-form-item>
             </up-form-item>
-            <up-form-item v-if="form.servicetype != '安装'" label="保修卡号" prop="cardno">
-                <up-input v-model="form.cardno" disabled placeholder="请输入序列号或选择产品" />
-            </up-form-item>
 
 
             <view class="title">
             <view class="title">
                 联系人信息
                 联系人信息
@@ -86,8 +78,11 @@
 
 
 
 
             <up-form-item label="省市县" :required="rules.province[0].required" prop="province">
             <up-form-item label="省市县" :required="rules.province[0].required" prop="province">
-                <My_region @select="changeRegion"> {{ form.province ? [form.province, form.city, form.county].join("-")
-                    : '选择省市县' }}
+                <My_region @select="changeRegion">
+                    <view class="region">
+                        {{ form.province ? [form.province, form.city, form.county].join("-")
+                            : '选择省市县' }}
+                    </view>
                 </My_region>
                 </My_region>
             </up-form-item>
             </up-form-item>
 
 
@@ -117,9 +112,9 @@
                 <view class="row">
                 <view class="row">
                     序列号: {{ item.sku || '--' }}
                     序列号: {{ item.sku || '--' }}
                 </view>
                 </view>
-                <view class="row">
+                <!-- <view class="row">
                     产品编号: {{ item.itemno || '--' }}
                     产品编号: {{ item.itemno || '--' }}
-                </view>
+                </view> -->
                 <view class="row">
                 <view class="row">
                     产品型号: {{ item.model || '--' }}
                     产品型号: {{ item.model || '--' }}
                 </view>
                 </view>
@@ -139,7 +134,7 @@
 import { ref, reactive, getCurrentInstance } from 'vue';
 import { ref, reactive, getCurrentInstance } from 'vue';
 const { $Http } = getCurrentInstance().proxy;
 const { $Http } = getCurrentInstance().proxy;
 import { onShow } from '@dcloudio/uni-app';
 import { onShow } from '@dcloudio/uni-app';
-const WuserRecord = uni.getStorageSync('WuserRecord') || {
+const WuserRecord = ref(uni.getStorageSync('WuserRecord') || {
     name: '',
     name: '',
     phonenumber: '',
     phonenumber: '',
     address: "",
     address: "",
@@ -148,7 +143,7 @@ const WuserRecord = uni.getStorageSync('WuserRecord') || {
     county: '',
     county: '',
     sys_enterpriseid: 0,
     sys_enterpriseid: 0,
     sa_customersid: 0
     sa_customersid: 0
-},
+}),
     WuserMsg = wx.getStorageSync('WuserMsg');
     WuserMsg = wx.getStorageSync('WuserMsg');
 
 
 const uFormRef = ref(null);
 const uFormRef = ref(null);
@@ -164,8 +159,8 @@ const form = reactive({
     itemno: '', // 产品编号
     itemno: '', // 产品编号
     model: '', // 产品型号
     model: '', // 产品型号
     cardno: '', // 保修卡号
     cardno: '', // 保修卡号
-    scenecontact: WuserRecord.name || WuserMsg.name || '', // 联系人
-    scenecontactphonenumber: WuserRecord.phonenumber || WuserMsg.phonenumber || '', // 联系人电话
+    scenecontact: '', // 联系人
+    scenecontactphonenumber: WuserRecord.value.phonenumber || WuserMsg.phonenumber || '', // 联系人电话
     province: '', // 省
     province: '', // 省
     city: '', // 市
     city: '', // 市
     county: '', // 县
     county: '', // 县
@@ -188,6 +183,12 @@ const rules = reactive({
     scenecontactphonenumber: [{ required: true, message: '请输入联系人电话', trigger: 'blur', pattern: /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/, message: '请输入正确的手机号码' }],
     scenecontactphonenumber: [{ required: true, message: '请输入联系人电话', trigger: 'blur', pattern: /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/, message: '请输入正确的手机号码' }],
 });
 });
 
 
+// 切换故障类型
+function changeClass2(e) {
+    let index = e.detail.value - 0;
+    form.class2 = class2.value[index].value;
+}
+
 // 切换服务类型
 // 切换服务类型
 function servicetypeChange(type) {
 function servicetypeChange(type) {
     rules.class2[0].required = type == '维修';
     rules.class2[0].required = type == '维修';
@@ -223,53 +224,55 @@ let loading = ref(false);
 function save() {
 function save() {
     if (querySku.value === false) return uni.showToast({ title: '序列号不正确', icon: 'none' });
     if (querySku.value === false) return uni.showToast({ title: '序列号不正确', icon: 'none' });
     if (loading.value) return;
     if (loading.value) return;
-    if (confirm) uFormRef.value.validate().then(valid => {
+    uFormRef.value.validate().then(valid => {
         if (valid) wx.showModal({
         if (valid) wx.showModal({
             content: '请确认预约信息正确以便后续服务,是否确认提交?',
             content: '请确认预约信息正确以便后续服务,是否确认提交?',
             title: '提示',
             title: '提示',
             success: ({ confirm }) => {
             success: ({ confirm }) => {
-                form.customername = form.scenecontact;
-                form.customerphonenumber = form.scenecontactphonenumber;
-                form.name = form.customername;
-                form.phonenumber = form.scenecontactphonenumber;
-                form.sa_customersid = WuserRecord.sa_customersid || 0;
-                form.sys_enterpriseid = WuserRecord.sys_enterpriseid || 0;
-                let content = {
-                    ...form,
-                };
-                loading.value = true;
-                $Http.basic({
-                    "id": "20230206091403",
-                    content
-                }).then(res => {
-                    loading.value = false;
-                    console.log("提交申请单", res);
-                    if (res.code !== 1) {
-                        uni.showToast({ title: res.code !== 1 ? res.msg : "保存成功", icon: 'none', mask: res.code == 1 });
-                    } else {
-                        uni.showModal({
-                            showCancel: false,
-                            content: "预约申请已提交,请保持电话畅通,以便后续服务人员联系您!",
-                            success: (success) => {
-                                uni.navigateBack();
-                            },
-                        })
-                        $Http.basic({
-                            id: 20230206101403,
-                            content: {
-                                sa_serviceorderid: res.data.sa_serviceorderid,
-                                backreason: "",
-                                issumbit: 1
-                            }
-                        }).then(res => {
-                            console.log("提交工单", res);
-                        })
-                    }
-                }).catch(err => {
-                    loading.value = false;
-                    console.error("保存工单失败", err);
-                    uni.showToast({ title: '保存失败,请稍后重试', icon: 'none' });
-                });
+                if (confirm) {
+                    form.customername = form.scenecontact;
+                    form.customerphonenumber = form.scenecontactphonenumber;
+                    form.name = form.customername;
+                    form.phonenumber = form.scenecontactphonenumber;
+                    form.sa_customersid = WuserRecord.value.sa_customersid || 0;
+                    form.sys_enterpriseid = WuserRecord.value.sys_enterpriseid || 0;
+                    let content = {
+                        ...form,
+                    };
+                    loading.value = true;
+                    $Http.basic({
+                        "id": "20230206091403",
+                        content
+                    }).then(res => {
+                        loading.value = false;
+                        console.log("提交申请单", res);
+                        if (res.code !== 1) {
+                            uni.showToast({ title: res.code !== 1 ? res.msg : "保存成功", icon: 'none', mask: res.code == 1 });
+                        } else {
+                            uni.showModal({
+                                showCancel: false,
+                                content: "预约申请已提交,请保持电话畅通,以便后续服务人员联系您!",
+                                success: (success) => {
+                                    uni.navigateBack();
+                                },
+                            })
+                            $Http.basic({
+                                id: 20230206101403,
+                                content: {
+                                    sa_serviceorderid: res.data.sa_serviceorderid,
+                                    backreason: "",
+                                    issumbit: 1
+                                }
+                            }).then(res1 => {
+                                console.log("提交工单", res1);
+                            })
+                        }
+                    }).catch(err => {
+                        loading.value = false;
+                        console.error("保存工单失败", err);
+                        uni.showToast({ title: '保存失败,请稍后重试', icon: 'none' });
+                    });
+                }
             },
             },
         })
         })
     })
     })
@@ -316,18 +319,10 @@ function skuConfirm() {
             res.data[0].contact = res.data[0].name;
             res.data[0].contact = res.data[0].name;
             res.data[0].serviceenterprisename = res.data[0].serviceenterprisename || res.data[0].enterprisename;
             res.data[0].serviceenterprisename = res.data[0].serviceenterprisename || res.data[0].enterprisename;
             ['contact', 'phonenumber', 'serviceenterprisename', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'unitname', 'spec', 'sys_enterpriseid'].forEach(key => {
             ['contact', 'phonenumber', 'serviceenterprisename', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'unitname', 'spec', 'sys_enterpriseid'].forEach(key => {
-                if (['province', 'city', 'county'].includes(key)) {
-                    if (!isNaN(form[key]) && form[key] !== '') {
-                        form[key] = '';
-                    } else {
-                        form[key] = res.data[0][key] || '';
-                    }
+                if ('sys_enterpriseid' == key) {
+                    WuserRecord.value.sys_enterpriseid = res.data[0][key] || 0;
                 } else {
                 } else {
-                    if ('sys_enterpriseid' == key) {
-                        WuserRecord.sys_enterpriseid = res.data[0][key] || 0;
-                    } else {
-                        form[key] = res.data[0][key] || '';
-                    }
+                    form[key] = res.data[0][key] || '';
                 }
                 }
             });
             });
             uni.showToast({ title: '已填充表单', icon: 'none' });
             uni.showToast({ title: '已填充表单', icon: 'none' });
@@ -346,7 +341,7 @@ function changeItem(item) {
     item.serviceenterprisename = item.serviceenterprisename || item.enterprisename;
     item.serviceenterprisename = item.serviceenterprisename || item.enterprisename;
     ['contact', 'serviceenterprisename', 'sku', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'phonenumber', 'unitname', 'spec', 'sys_enterpriseid'].forEach(key => {
     ['contact', 'serviceenterprisename', 'sku', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'phonenumber', 'unitname', 'spec', 'sys_enterpriseid'].forEach(key => {
         if ('sys_enterpriseid' == key) {
         if ('sys_enterpriseid' == key) {
-            WuserRecord.sys_enterpriseid = item[key] || 0;
+            WuserRecord.value.sys_enterpriseid = item[key] || 0;
         } else {
         } else {
             form[key] = item[key] || '';
             form[key] = item[key] || '';
         }
         }
@@ -366,34 +361,13 @@ function openScan() {
         uni.navigateBack()
         uni.navigateBack()
         delete $Http.getCode;
         delete $Http.getCode;
     }
     }
-    return
-    uni.chooseImage({
-        count: 1,
-        success: imgRes => {
-            const imagePath = imgRes.tempFilePaths[0];
-
-            const img = new Image();
-            img.src = imagePath;
-
-            img.onload = async () => {
-                const codeReader = new BrowserMultiFormatReader();
-                try {
-                    const result = await codeReader.decodeFromImageElement(img);
-                    form.sku = result.text;
-                    skuConfirm();
-                } catch (err) {
-                    console.log(err)
-                    uni.showToast({ title: '未识别出二维码或条码', icon: 'none' });
-                }
-            };
-        }
-    });
 }
 }
 
 
 //去选择产品
 //去选择产品
 function toSelectProduct() {
 function toSelectProduct() {
+    // return console.log('选择我的产品', form.class1);
     uni.navigateTo({
     uni.navigateTo({
-        url: '/pages/select/product'
+        url: '/pages/select/product?topclassnum=' + form.class1
     });
     });
     $Http.onSelected = (item) => {
     $Http.onSelected = (item) => {
         ['contact', 'serviceenterprisename', 'sku', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'phonenumber', 'unitname', 'spec'].forEach(key => {
         ['contact', 'serviceenterprisename', 'sku', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'phonenumber', 'unitname', 'spec'].forEach(key => {
@@ -404,24 +378,16 @@ function toSelectProduct() {
     }
     }
 }
 }
 
 
-function toSelectProduct2() {
+function toSelectMyProduct() {
     uni.navigateTo({
     uni.navigateTo({
         url: '/pages/select/myProduct'
         url: '/pages/select/myProduct'
     });
     });
     $Http.onSelected = (item) => {
     $Http.onSelected = (item) => {
         ['contact', 'phonenumber', 'sku', 'serviceenterprisename', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'unitname', 'spec', 'sys_enterpriseid'].forEach(key => {
         ['contact', 'phonenumber', 'sku', 'serviceenterprisename', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'unitname', 'spec', 'sys_enterpriseid'].forEach(key => {
-            if (['province', 'city', 'county'].includes(key)) {
-                if (!isNaN(form[key]) && form[key] !== '') {
-                    form[key] = '';
-                } else {
-                    form[key] = item[key] || '';
-                }
+            if ('sys_enterpriseid' == key) {
+                WuserRecord.value.sys_enterpriseid = item[key] || 0;
             } else {
             } else {
-                if ('sys_enterpriseid' == key) {
-                    WuserRecord.sys_enterpriseid = item[key] || 0;
-                } else {
-                    form[key] = item[key] || '';
-                }
+                form[key] = item[key] || '';
             }
             }
         });
         });
         uni.navigateBack()
         uni.navigateBack()
@@ -440,12 +406,12 @@ function toSelectProduct2() {
 
 
 
 
     .picker {
     .picker {
-        width: 100%;
-        // border-bottom: 1px solid #dadbde;
-        font-size: 32rpx;
+        font-size: 28rpx;
         color: #606266;
         color: #606266;
         padding: 9px;
         padding: 9px;
         border-radius: 8rpx;
         border-radius: 8rpx;
+        border: 1rpx solid #2979FF;
+        color: #2979FF;
     }
     }
 
 
     .title {
     .title {
@@ -454,6 +420,16 @@ function toSelectProduct2() {
         margin: 20rpx 0;
         margin: 20rpx 0;
         font-weight: bold;
         font-weight: bold;
     }
     }
+
+    .region {
+        font-size: 28rpx;
+        color: #606266;
+        padding: 10px 9px;
+        width: 280px;
+        box-sizing: border-box;
+        border-radius: 8rpx;
+        border: 1rpx solid #dadbde !important;
+    }
 }
 }
 
 
 .product {
 .product {

+ 9 - 5
pages/select/product.vue

@@ -19,12 +19,12 @@
                     </text>
                     </text>
                     {{ item.itemname || ' --' }}
                     {{ item.itemname || ' --' }}
                 </view>
                 </view>
-                <view class="row">
+                <!--     <view class="row">
                     <text class="label">
                     <text class="label">
                         产品编号
                         产品编号
                     </text>
                     </text>
                     {{ item.itemno || ' --' }}
                     {{ item.itemno || ' --' }}
-                </view>
+                </view> -->
                 <view class="row">
                 <view class="row">
                     <text class="label">
                     <text class="label">
                         产品型号
                         产品型号
@@ -61,8 +61,9 @@ const content = reactive({
     "pageNumber": 1,
     "pageNumber": 1,
     "pageSize": 15,
     "pageSize": 15,
     "where": {
     "where": {
-        "status": '',
-        "condition": ""
+        "status": '审核',
+        "condition": "",
+        ismodule: 0
     }
     }
 });
 });
 
 
@@ -74,7 +75,10 @@ function onSearch(e) {
 }
 }
 const list = ref([])
 const list = ref([])
 
 
-onLoad(() => {
+onLoad((options) => {
+    if (options.topclassnum) {
+        content.where.topclassnum = options.topclassnum;
+    };
     getList();
     getList();
 });
 });
 
 

+ 2 - 2
pages/serviceSeeking/detail.vue

@@ -160,11 +160,11 @@
         </view>
         </view>
     </view>
     </view>
 
 
-    <up-transition :show="detail.nodes.length != 0">
+ <!--    <up-transition :show="detail.nodes.length != 0">
         <view class="main" style="padding: 30rpx;">
         <view class="main" style="padding: 30rpx;">
             <nodes ref="Nodes" :nodes="detail.nodes" />
             <nodes ref="Nodes" :nodes="detail.nodes" />
         </view>
         </view>
-    </up-transition>
+    </up-transition> -->
 
 
     <view style="height: 50px;" />
     <view style="height: 50px;" />
 </template>
 </template>

+ 10 - 14
pages/serviceSeeking/index.vue

@@ -1,22 +1,18 @@
 <template>
 <template>
     <My-shade />
     <My-shade />
-    <view v-if="!['待接单', '已完成'].includes(content.where.status)" style="background-color: #fff;">
-        <up-tabs lineColor="#3874F6" :scrollable="false" :list="[{
-            name: '安装'
-        }, {
-            name: '维修'
-        }, {
-            name: '清洗'
-        }]" @click="tabClick" />
-    </view>
     <My_listbox ref="listBox" :empty="!list.length" @getlist="getList">
     <My_listbox ref="listBox" :empty="!list.length" @getlist="getList">
         <view style="height: 18rpx;" />
         <view style="height: 18rpx;" />
         <view class="item" v-for="item in list" :key="item.sa_serviceorderid" hover-class="navigator-hover">
         <view class="item" v-for="item in list" :key="item.sa_serviceorderid" hover-class="navigator-hover">
             <navigator :url="'/pages/serviceSeeking/detail?id=' + item.sa_serviceorderid" hover-class="none">
             <navigator :url="'/pages/serviceSeeking/detail?id=' + item.sa_serviceorderid" hover-class="none">
                 <view class="head">
                 <view class="head">
-                    <view class="tag"
-                        :style="{ 'background': { '已完结': '#333', '拒绝受理': '#333' }[item.status] || '#3874F6' }">
-                        {{ item.status }}
+                    <view style="display: flex;">
+                        <view class="tag" style="margin-right: 20rpx;"
+                            :style="{ 'background': { '安装': '#70B603', '维修': '#D9001B', '清洁': '#3874F6', '清洗': '#3874F6' }[item.servicetype] || '#999999' }">
+                            {{ item.servicetype || '--' }}</view>
+                        <view class="tag"
+                            :style="{ 'background': { '已完结': '#333', '拒绝受理': '#333' }[item.status] || '#3874F6' }">
+                            {{ item.status }}
+                        </view>
                     </view>
                     </view>
                     <view class="time">
                     <view class="time">
                         {{ item.createdate }}
                         {{ item.createdate }}
@@ -36,7 +32,7 @@
                         'background-color': '#FFFFFF',
                         'background-color': '#FFFFFF',
                         'color': '#3874F6',
                         'color': '#3874F6',
                         height: '70rpx',
                         height: '70rpx',
-                    }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="item.servicephonenumber" />
+                    }" frontIcon="icon-bodadianhua1" text="服务商电话" :phonenumber="item.servicephonenumber" />
                 </view>
                 </view>
 
 
                 <navigator :url="'/pages/serviceSeeking/detail?id=' + item.sa_serviceorderid" class="but-box-item">
                 <navigator :url="'/pages/serviceSeeking/detail?id=' + item.sa_serviceorderid" class="but-box-item">
@@ -61,7 +57,7 @@ const content = reactive({
     "pageNumber": 1,
     "pageNumber": 1,
     "pageSize": 20,
     "pageSize": 20,
     "where": {
     "where": {
-        "servicetype": '安装',
+        "servicetype": '',
     }
     }
 });
 });
 const list = ref([])
 const list = ref([])