Selaa lähdekoodia

待开始状态信息修改确认,还存在问题未解决

xiaohaizhao 2 kuukautta sitten
vanhempi
commit
902969c851

+ 12 - 0
pages.json

@@ -23,6 +23,18 @@
 			"style": {
 				"navigationBarTitleText": "工单详情"
 			}
+		},
+		{
+			"path": "pages/workOrder/changeMsg",
+			"style": {
+				"navigationBarTitleText": "信息修改"
+			}
+		},
+		{
+			"path": "pages/select/product",
+			"style": {
+				"navigationBarTitleText": "选择产品"
+			}
 		}
 	],
 	"globalStyle": {

+ 1 - 1
pages/login/login.vue

@@ -31,7 +31,7 @@
             </view>
         </view>
 
-        <up-modal asyncClose :show="showModal" confirmColor="#052E5D" showCancelButton confirmText="阅读并获取"
+        <up-modal negativeTop="100" asyncClose :show="showModal" confirmColor="#052E5D" showCancelButton confirmText="阅读并获取"
             @confirm="onConfirm1" @cancel="showModal = false">
             <view class="modal-u">请阅读并同意<text style="color: #3874F6;" @click="checkTheAgreement">《隐私协议》</text></view>
         </up-modal>

+ 153 - 0
pages/select/product.vue

@@ -0,0 +1,153 @@
+<template>
+    <view class="search-box">
+        <up-search placeholder="搜索关键词" v-model="keyword" height="35" @blur="onSearch" :clearabled="false"
+            :showAction="false" />
+        <view v-if="content.where.condition" class="clear" @click.stop="onSearch('')">
+            <up-icon name="close-circle-fill" size="20" />
+        </view>
+    </view>
+    <view style="height: 20rpx; " />
+    <My_listbox ref="listBox" :empty="!list.length" @getlist="getList">
+        <view class="item" hover-class="navigator-hover" v-for="item in list" :key="item.itemid"
+            @click="selected(item)">
+            <view class="itemname">{{ item.itemname }}</view>
+            <view class="row">
+                <view class="label">
+                    产品编号:
+                </view>
+                <view class="value">
+                    {{ item.itemno || '--' }}
+                </view>
+            </view>
+            <view class="row">
+                <view class="label">
+                    型号/规格:
+                </view>
+                <view class="value">
+                    {{ item.model }}/{{ item.spec || '--' }}
+                </view>
+            </view>
+            <view class="row">
+                <view class="label">
+                    计量单位:
+                </view>
+                <view class="value">
+                    {{ item.unitname || '--' }}
+                </view>
+            </view>
+        </view>
+    </My_listbox>
+</template>
+
+<script setup>
+import { ref, reactive, getCurrentInstance } from 'vue';
+const { $Http } = getCurrentInstance().proxy;
+import { onLoad } from '@dcloudio/uni-app';
+
+const keyword = ref('');
+const listBox = ref(null);
+const content = reactive({
+    loading: false,
+    "pageNumber": 1,
+    "pageSize": 20,
+    "where": {
+        "status": '',
+        "condition": ""
+    }
+});
+
+function onSearch(e) {
+    if (content.where.condition == e) return;
+    content.where.condition = e;
+    keyword.value = e;
+    getList(true);
+}
+const list = ref([])
+
+onLoad(() => {
+    getList();
+});
+
+function getList(init = false) {
+    if (content.loading) return;
+    content.loading = true;
+    if (init) content.pageNumber = 1;
+    $Http.basic({
+        "id": "20220923140602",
+        content
+    }).then(res => {
+        content.loading = false;
+        console.log("获取产品列表", res)
+        listBox.value.refreshToComplete();
+        listBox.value.setHeight();
+        if (res.code == 1) {
+            list.value = reactive(res.firstPage ? res.data : list.value.concat(res.data));
+            content.pageTotal = res.pageTotal;
+            content.pageNumber = res.pageNumber;
+        } else {
+            if (res.msg) uni.showToast({
+                title: res.msg,
+                icon: 'none'
+            });
+        }
+    })
+}
+
+function selected(item) {
+    $Http.onSelected && $Http.onSelected(item)
+}
+</script>
+
+<style lang="scss" scoped>
+.search-box {
+    position: relative;
+    padding: 20rpx;
+    background: #fff;
+
+    .clear {
+        position: absolute;
+        display: flex;
+        align-items: center;
+        right: 0;
+        top: 50%;
+        transform: translateY(-50%);
+        width: 80rpx;
+        padding-left: 10rpx;
+        height: 70rpx;
+        z-index: 2;
+    }
+}
+
+.item {
+    width: 690rpx;
+    background: #FFFFFF;
+    box-shadow: 0rpx 4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    border-radius: 10rpx;
+    padding: 40rpx;
+    box-sizing: border-box;
+    margin: 0 auto 20rpx;
+
+    .itemname {
+        line-height: 38rpx;
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        font-size: 32rpx;
+        color: #333333;
+    }
+
+    .row {
+        display: flex;
+        line-height: 32rpx;
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        font-size: 28rpx;
+        margin-top: 20rpx;
+
+        .label {
+            color: #999999;
+        }
+
+        .value {
+            color: #333333;
+        }
+    }
+}
+</style>

+ 281 - 0
pages/workOrder/changeMsg.vue

@@ -0,0 +1,281 @@
+<template>
+    <view class="content"><!-- labelAlign="right" -->
+        <up-form :model="form" labelWidth="70" ref="uFormRef">
+            <view class="title" style="margin-top: 0;">
+                服务信息
+            </view>
+            <up-form-item label="产品品类" prop="class1">
+                <up-radio-group v-model="form.class1">
+                    <up-radio :customStyle="{ marginLeft: '12px' }" v-for="(item) in class1" :key="item.value"
+                        :label="item.value" :name="item.value">
+                    </up-radio>
+                </up-radio-group>
+            </up-form-item>
+
+            <up-form-item label="服务类型" prop="servicetype">
+                <up-radio-group v-model="form.servicetype">
+                    <up-radio :customStyle="{ marginLeft: '12px' }" v-for="(item) in ['安装', '维修', '清洗']" :key="item"
+                        :label="item" :name="item">
+                    </up-radio>
+                </up-radio-group>
+            </up-form-item>
+
+            <up-form-item label="服务地址" prop="province">
+                <picker class="picker" mode="region" :value="[form.province, form.city, form.county]"
+                    @change="changeRegion">
+                    {{ [form.province, form.city, form.county].join("-") || '选择省市县' }}
+                </picker>
+            </up-form-item>
+
+            <view style="margin-top: -30rpx;">
+                <up-form-item label="" prop="address">
+                    <up-textarea v-model="form.address" placeholder="详细地址" autoHeight height="20" />
+                </up-form-item>
+            </view>
+
+            <up-form-item label="联系人" prop="scenecontact">
+                <up-input v-model="form.scenecontact" placeholder="联系人" clearable />
+            </up-form-item>
+
+            <up-form-item label="联系人电话" prop="scenecontactphonenumber">
+                <up-input type="number" v-model="form.scenecontactphonenumber" placeholder="联系人电话" clearable />
+            </up-form-item>
+
+            <view class="title">
+                产品信息
+            </view>
+
+            <up-form-item label="序列号" prop="sku">
+                <up-input v-model="form.sku" :disabled="disabled" placeholder="序列号" clearable @blur="skuConfirm">
+                    <template #suffix>
+                        <up-icon v-if="!disabled" name="scan" color="#2979ff" size="28" @click="openScan" />
+                    </template>
+                </up-input>
+            </up-form-item>
+            <up-form-item label="产品名称" prop="itemname">
+                <up-input v-model="form.itemname" disabled placeholder="选择产品">
+                    <template #suffix>
+                        <up-button v-if="!disabled" type="success" size="mini" text="选择产品" @click="toSelectProduct" />
+                    </template>
+                </up-input>
+            </up-form-item>
+
+            <up-form-item label="产品型号" prop="model">
+                <up-input v-model="form.model" disabled placeholder="型号" />
+            </up-form-item>
+
+            <up-form-item label="经销商" prop="serviceenterprisename">
+                <up-input v-model="form.serviceenterprisename" disabled placeholder="经销商" />
+            </up-form-item>
+            <up-form-item label="客户名称" prop="contact">
+                <up-input v-model="form.contact" disabled placeholder="客户名称" />
+            </up-form-item>
+            <up-form-item label="客户电话" prop="phonenumber">
+                <up-input v-model="form.phonenumber" disabled placeholder="客户电话" />
+            </up-form-item>
+            <up-form-item label="保修卡号" prop="cardno">
+                <up-input v-model="form.cardno" disabled placeholder="保修卡号" />
+            </up-form-item>
+        </up-form>
+        <view style="padding-bottom: 50px;width: 350rpx;margin: 40rpx auto 0;" @click="save">
+            <My-button text="保存" :loading="loading" />
+        </view>
+    </view>
+</template>
+
+<script setup>
+import { ref, reactive, getCurrentInstance } from 'vue';
+const { $Http } = getCurrentInstance().proxy;
+import { onLoad } from '@dcloudio/uni-app';
+
+const uFormRef = ref(null);
+const form = reactive({
+    class1: '', // 产品品类
+    servicetype: '', // 服务类型
+    address: "", // 详细地址
+    province: '', // 省份
+    city: '', // 城市
+    county: '', // 区县
+    scenecontact: '', // 联系人
+    scenecontactphonenumber: '', // 联系人电话
+    sku: '', // 序列号
+    'contact': "", // 客户名称
+    'itemid': "", //    产品ID
+    'itemname': "", // 产品名称
+    'itemno': "", // 产品编号
+    'model': "", // 型号
+    'phonenumber': "", // 客户电话
+    'unitname': "", // 计量单位
+    'spec': "", // 规格
+    serviceenterprisename: "", //  经销商
+    cardno: "" // 保修卡号
+});
+const rules = reactive({
+    class1: [{ required: true, message: '请选择产品品类', trigger: 'change' }],
+    servicetype: [{ required: true, message: '请选择服务类型', trigger: 'change' }],
+    province: [{ required: true, message: '请选择省市县', trigger: 'change' }],
+    address: [{ required: true, message: '请输入详细地址', trigger: 'blur' }],
+    scenecontact: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
+    sku: [{ required: form.servicetype == '安装', message: '请输入序列号', trigger: 'blur' }],
+    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: '请输入正确的手机号码' }],
+});
+
+const class1 = ref(''); // 产品品类
+
+let sa_workorderid = 0;
+
+onLoad((options) => {
+    sa_workorderid = options.id;
+    getDetail()
+    $Http.getClass('prodclass1').then(res => {
+        uFormRef.value.setRules(rules);
+        class1.value = res.data;
+        if (res.code !== 1) return uni.showToast({ title: res.msg, icon: 'none' });
+    });
+});
+
+let detail = reactive({});
+
+// 保存
+let loading = ref(false);
+
+function save() {
+    if (loading.value) return;
+    console.log("form", form);
+    uFormRef.value.validate().then(valid => {
+        if (valid) {
+            let content = {
+                "sa_workorderid": sa_workorderid,
+                ...form
+            };
+            loading.value = true;
+            $Http.basic({
+                "id": "20230208140003",
+                content
+            }).then(res => {
+                loading.value = false;
+                console.log("保存工单", res);
+                uni.showToast({ title: res.code !== 1 ? res.msg : "保存成功", icon: 'none', mask: res.code == 1 });
+                if (res.code == 1) setTimeout(() => {
+                    uni.navigateBack();
+                }, 500);
+            }).catch(err => {
+                loading.value = false;
+                console.error("保存工单失败", err);
+                uni.showToast({ title: '保存失败,请稍后重试', icon: 'none' });
+            });
+        }
+    })
+}
+let disabled = ref(false);
+function getDetail() {
+    $Http.basic({ "id": "20230208140103", "content": { "nocache": true, sa_workorderid } }).then(res => {
+        console.log("工单详情", res)
+        if (res.code !== 1) return uni.showToast({ title: res.msg, icon: 'none' });
+        detail = reactive(res.data);
+        for (const key in form) {
+            if (detail[key] !== undefined) {
+                form[key] = detail[key];
+            }
+        }
+        disabled.value = form.sku || form.itemid ? true : false
+    })
+}
+
+function changeRegion(e) {
+    form.province = e.detail.value[0];
+    form.city = e.detail.value[1];
+    form.county = e.detail.value[2];
+}
+
+function skuConfirm() {
+    ['contact', 'serviceenterprisename', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'phonenumber', 'unitname', 'spec'].forEach(key => {
+        form[key] = '';
+    });
+    if (form.sku) {
+        $Http.basic({
+            "id": 20230105110003,
+            "content": {
+                "pageNumber": 1,
+                "pageSize": 1,
+                "where": {
+                    condition: form.sku,
+                }
+            }
+        }).then(res => {
+            console.log(res)
+            if (res.code !== 1) return uni.showToast({ title: res.msg, icon: 'none' });
+            if (res.data.length === 0 || res.data[0].sku !== form.sku) {
+                uni.showToast({ title: '未找到对应的产品信息', icon: 'none' });
+                return;
+            }
+            ['contact', 'serviceenterprisename', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'phonenumber', 'unitname', 'spec'].forEach(key => {
+                form[key] = res.data[0][key] || '';
+            });
+        })
+    } else {
+        form.sku = '';
+    }
+}
+
+function openScan() {
+    uni.scanCode({
+        onlyFromCamera: true,
+        scanType: ['qrCode', 'barCode'],
+        success: (res) => {
+            console.log("扫码结果", res);
+            if (res.result) {
+                form.sku = res.result;
+                skuConfirm();
+            } else {
+                uni.showToast({ title: '扫码失败,请重试', icon: 'none' });
+            }
+        },
+        fail: (err) => {
+            console.error("扫码失败", err);
+            uni.showToast({ title: '扫码失败,请重试', icon: 'none' });
+        }
+    });
+}
+
+//去选择产品
+function toSelectProduct() {
+    uni.navigateTo({
+        url: '/pages/select/product'
+    });
+    $Http.onSelected = (item) => {
+        ['contact', 'serviceenterprisename', 'sku', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'phonenumber', 'unitname', 'spec'].forEach(key => {
+            form[key] = item[key] || '';
+        });
+        wx.navigateBack()
+        delete $Http.onSelected
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.content {
+    width: 100vw;
+    padding: 20px;
+    box-sizing: border-box;
+    min-height: 100vh;
+    background: #fff;
+
+
+    .picker {
+        width: 100%;
+        // border-bottom: 1px solid #dadbde;
+        font-size: 32rpx;
+        color: #606266;
+        padding: 9px;
+        border-radius: 8rpx;
+    }
+
+    .title {
+        font-size: 34rpx;
+        color: #4773EE;
+        margin: 20rpx 0;
+        font-weight: bold;
+    }
+}
+</style>

+ 70 - 5
pages/workOrder/detail.vue

@@ -11,7 +11,7 @@
         <view class="row">
             <view class="label col-center">服务类型</view>
             <view class="servicetype"
-                :style="{ 'background': { '安装': '#70B603', '维修': '#D9001B', '清洁': '#3874F6' }[detail.servicetype] || '#999999' }">
+                :style="{ 'background': { '安装': '#70B603', '维修': '#D9001B', '清洁': '#3874F6', '清洗': '#3874F6' }[detail.servicetype] || '#999999' }">
                 {{ detail.servicetype || '--' }}</view>
         </view>
         <view class="row">
@@ -39,6 +39,8 @@
                         'background-color': '#FFFFFF',
                         'color': '#3874F6',
                         borderRadius: '10rpx'
+                    }" :frontIconStyle="{
+                        marginRight: '6rpx',
                     }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="detail.scenecontactphonenumber" />
                 </block>
             </view>
@@ -109,17 +111,40 @@
             </view>
             <view class="but-box-item" @click="takeOrderShow = true">
                 <My-button frontIcon="icon-dianhua" text="接单" />
-                <up-modal :show="takeOrderShow" title="是否确认接单?" showCancelButton @confirm="takeOrders"
+                <up-modal negativeTop="100" :show="takeOrderShow" title="是否确认接单?" showCancelButton @confirm="takeOrders"
                     @cancel="takeOrderShow = false" ref="uModal" :asyncClose="true"></up-modal>
             </view>
         </view>
+        <!-- 底部按钮 -->
+        <view v-else-if="detail.status == '待开始'" class="but-box">
+            <view class="but-box-item" @click="toChangeMsg">
+                <My-button :customStyle="{
+                    'background-color': '#FFFFFF',
+                    'color': '#3874F6',
+                }" text="信息修改" />
+            </view>
+            <view class="but-box-item" @click="confirmStartShow = true">
+                <My-button text="确认开始" />
+                <up-modal negativeTop="100" :show="confirmStartShow" showCancelButton @confirm="confirmStart"
+                    @cancel="confirmStartShow = false" ref="uModal" :asyncClose="true">
+                    <view class="slot-content">
+                        <view>
+                            请仔细核对服务信息和客户信息
+                        </view>
+                        <view style="margin-top: 20rpx;">
+                            开始工单后确认信息将不可修改!
+                        </view>
+                    </view>
+                </up-modal>
+            </view>
+        </view>
     </view>
 </template>
 
 <script setup>
 import { ref, reactive, getCurrentInstance } from 'vue';
 const { $Http } = getCurrentInstance().proxy;
-import { onLoad } from '@dcloudio/uni-app';
+import { onLoad, onShow } from '@dcloudio/uni-app';
 
 const current = ref(-1);
 const steps = reactive([
@@ -132,11 +157,16 @@ const steps = reactive([
 let sa_workorderid = 0;
 onLoad((options) => {
     sa_workorderid = options.id;
-    getDetail()
 });
+
+onShow(() => {
+    getDetail()
+})
+
 let detail = reactive({
     itemsText: []
 });
+
 function getDetail() {
     $Http.basic({ "id": "20230208140103", "content": { "nocache": true, sa_workorderid } }).then(res => {
         console.log("工单详情", res)
@@ -151,7 +181,7 @@ function getDetail() {
 
 
 // 接单
-let takeOrderShow = ref(false);
+const takeOrderShow = ref(false);
 
 function takeOrders() {
     $Http.basic({
@@ -176,6 +206,41 @@ function takeOrders() {
         }
     })
 }
+
+// 修改信息
+function toChangeMsg() {
+    uni.navigateTo({
+        url: `/pages/workOrder/changeMsg?id=` + sa_workorderid
+    });
+};
+
+// 确认开始
+const confirmStartShow = ref(false);
+
+function confirmStart() {
+    $Http.basic({
+        id: 20230209144503,
+        "content": {
+            "sa_workorderid": detail.sa_workorderid
+        }
+    }).then(res => {
+        console.log("确认开始", res)
+        if (res.code == 1) {
+            confirmStartShow.value = false;
+            getDetail();
+            uni.showToast({
+                title: '确认开始成功',
+                icon: 'none'
+            });
+        } else {
+            if (res.msg) uni.showToast({
+                title: res.msg,
+                icon: 'none'
+            });
+        }
+    })
+}
+
 </script>
 
 <style lang="scss" scoped>

+ 9 - 2
pages/workOrder/index.vue

@@ -15,7 +15,7 @@
             :url="'/pages/workOrder/detail?id=' + item.sa_workorderid" hover-class="navigator-hover">
             <view class="head">
                 <view class="tag"
-                    :style="{ 'background': { '安装': '#70B603', '维修': '#D9001B', '清洁': '#3874F6' }[item.type] || '#999999' }">
+                    :style="{ 'background': { '安装': '#70B603', '维修': '#D9001B', '清洁': '#3874F6', '清洗': '#3874F6' }[item.type] || '#999999' }">
                     {{ item.type }}
                 </view>
                 <view class="time">
@@ -50,7 +50,7 @@
         </navigator>
     </My_listbox>
 
-    <up-modal :show="takeOrderShow" title="是否确认接单?" showCancelButton @confirm="takeOrders"
+    <up-modal negativeTop="100" :show="takeOrderShow" title="是否确认接单?" showCancelButton @confirm="takeOrders"
         @cancel="takeOrderShow = false" ref="uModal" :asyncClose="true"></up-modal>
 </template>
 
@@ -61,6 +61,7 @@ import { onLoad, onShow } from '@dcloudio/uni-app';
 
 const listBox = ref(null);
 const content = reactive({
+    loading: false,
     isadmin: 1,
     "pageNumber": 1,
     "pageSize": 20,
@@ -105,12 +106,15 @@ onShow(() => {
 })
 
 function getList(init = false) {
+    if (content.loading) return;
     if (init) content.pageNumber = 1;
+    content.loading = true;
     $Http.basic({
         "id": "20230208140203",
         content
     }).then(res => {
         console.log("获取列表", res)
+        content.loading = false;
         listBox.value.refreshToComplete();
         listBox.value.setHeight();
         if (res.code == 1) {
@@ -128,10 +132,12 @@ function getList(init = false) {
 
 let takeOrderShow = ref(false);
 let takeItem = null;
+
 function openModel(item) {
     takeItem = item;
     takeOrderShow.value = true;
 }
+
 function takeOrders() {
     $Http.basic({
         id: 20230210101103,
@@ -160,6 +166,7 @@ function takeOrders() {
         }
     })
 }
+
 </script>
 
 <style lang="scss" scoped>

+ 9 - 0
utils/api.js

@@ -45,6 +45,15 @@ class ApiModel extends HTTP {
             loading
         })
     }
+    getClass(typename) {
+        return this.basic({
+            "classname": "sysmanage.develop.optiontype.optiontype",
+            "method": "optiontypeselect",
+            "content": {
+                "typename": typename
+            }
+        })
+    }
     /* 无状态 */
     base(data, loading = true) {
         return this.request({