Browse Source

添加发起服务申请应用

xiaohaizhao 2 months ago
parent
commit
53b0b6ebf2

+ 6 - 0
pages.json

@@ -77,6 +77,12 @@
 			"style": {
 				"navigationBarTitleText": "选择序列号"
 			}
+		},
+		{
+			"path": "pages/launchApplication/customer",
+			"style": {
+				"navigationBarTitleText": "客户档案选择"
+			}
 		}
 	],
 	"globalStyle": {

+ 171 - 0
pages/launchApplication/customer.vue

@@ -0,0 +1,171 @@
+<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.sa_customersid"
+            @click="selected(item)">
+            <view class="content">
+                <view class="row">
+                    <text class="label">
+                        姓名
+                    </text>
+                    {{ item.name || ' --' }}
+                </view>
+                <view class="row">
+                    <text class="label">
+                        电话
+                    </text>
+                    {{ item.phonenumber || ' --' }}
+                </view>
+                <view class="row">
+                    <text class="label">
+                        省市县
+                    </text>
+                    {{ item.province ? item.province + item.city + item.county : ' --' }}
+                </view>
+                <view class="row">
+                    <text class="label">
+                        地址
+                    </text>
+                    {{ item.address || ' --' }}
+                </view>
+                <view class="row">
+                    <text class="label">
+                        创建日期
+                    </text>
+                    {{ item.createdate || ' --' }}
+                </view>
+            </view>
+        </view>
+        <view style="height: 30px;" />
+    </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": {
+        "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) {
+        listBox.value.refreshToComplete();
+        listBox.value.setHeight();
+        return
+    };
+    content.loading = true;
+    if (init) content.pageNumber = 1;
+    $Http.basic({
+        "id": "2025090909115603",
+        content
+    }).then(res => {
+        content.loading = false;
+        if (res.code != 1) return uni.showToast({
+            title: res.msg,
+            icon: 'none'
+        });
+        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 {
+    position: relative;
+    display: flex;
+    width: 95%;
+    box-shadow: 0rpx 4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    border-radius: 10rpx;
+    box-sizing: border-box;
+    padding: 20rpx 30rpx;
+    overflow: hidden;
+    margin: 0 auto 20rpx;
+    background: #fff;
+
+    .content {
+        margin-left: 20rpx;
+
+        .row {
+            display: flex;
+            line-height: 32rpx;
+            font-family: Microsoft YaHei, Microsoft YaHei;
+            font-size: 24rpx;
+            margin-top: 8rpx;
+
+            .label {
+                color: #666;
+                flex-shrink: 0;
+            }
+
+            .label::after {
+                content: ':';
+            }
+        }
+    }
+}
+</style>

+ 34 - 8
pages/launchApplication/index.vue

@@ -44,6 +44,15 @@
                 </up-input>
             </up-form-item>
 
+            <up-form-item label="客户名称" :required="rules.customername[0].required" prop="customername">
+                <up-input v-model="form.customername" :disabled="disabledCustomername" placeholder="客户名称">
+                    <template #suffix>
+                        <up-button type="success" v-if="form.sku && form.sa_customersid == 0" size="mini" text="客户档案查询"
+                            @click="queryCustomer" />
+                    </template>
+                </up-input>
+            </up-form-item>
+
             <up-form-item label="客户电话" :required="rules.customerphonenumber[0].required" prop="customerphonenumber">
                 <up-input v-model="form.customerphonenumber" placeholder="客户电话">
                     <template #suffix>
@@ -52,11 +61,6 @@
                     </template>
                 </up-input>
             </up-form-item>
-
-            <up-form-item label="客户名称" :required="rules.customername[0].required" prop="customername">
-                <up-input v-model="form.customername" :disabled="disabledCustomername" placeholder="客户名称" />
-            </up-form-item>
-
             <up-form-item label="产品名称" prop="itemname" :required="rules.itemname[0].required">
                 <up-input v-model="form.itemname" disabled placeholder="请输入序列号或选择产品"></up-input>
             </up-form-item>
@@ -111,9 +115,6 @@
                 <view class="row">
                     序列号: {{ item.sku || '--' }}
                 </view>
-                <!-- <view class="row">
-                    产品编号: {{ item.itemno || '--' }}
-                </view> -->
                 <view class="row">
                     产品型号: {{ item.model || '--' }}
                 </view>
@@ -180,6 +181,7 @@ const rules = reactive({
     cardno: [{ required: false, message: '请输入保修卡号', trigger: 'blur' }],
     province: [{ required: true, message: '请选择省市县', trigger: 'change' }],
     address: [{ required: true, message: '请输入详细地址', trigger: 'blur' }],
+    sa_customersid: [{ required: true }],
     customername: [{ required: true, disabled: true, message: '请输客户名称', trigger: 'blur' }],
     customerphonenumber: [{ 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: '请输入正确的手机号码' }],
     scenecontact: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
@@ -242,6 +244,7 @@ function save() {
                     form.customerphonenumber = form.scenecontactphonenumber;
                     form.name = form.customername;
                     form.phonenumber = form.scenecontactphonenumber;
+                    form.sa_customersid = form.sa_customersid || 0;
                     let content = {
                         ...form,
                     };
@@ -413,6 +416,29 @@ function toSelectMyProduct() {
         delete $Http.onSelected
     }
 }
+
+function queryCustomer() {
+    uni.navigateTo({
+        url: '/pages/launchApplication/customer'
+    });
+    $Http.onSelected = (item) => {
+        console.log("32332323", item);
+        ['name', 'phonenumber', 'sa_customersid', 'province', 'city', 'county', 'address'].forEach(key => {
+            if (key == 'name') {
+                form.scenecontact = item['name'];
+                form.customername = item['name'];
+                disabledCustomername.value = item['name'] != ''
+            } else if (key == 'phonenumber') {
+                form.customerphonenumber = item['phonenumber'];
+                form.scenecontactphonenumber = item['phonenumber'];
+            }
+            if (item[key]) form[key] = item[key] || '';
+        })
+        uni.navigateBack()
+        delete $Http.onSelected
+    }
+}
+
 </script>
 
 <style lang="scss" scoped>

+ 5 - 0
pages/login/login.vue

@@ -402,6 +402,11 @@ function handleLogin1(data) {
 const isAgreement = ref(false);
 const showModal = ref(false);
 
+if ($Http.baseUrl != "https://crm.meida.com:16691") {
+    imagecaptcha.value = '8888';
+    isAgreement.value = true;
+}
+
 function checkTheAgreement() {
     uni.showLoading({
         title: "加载中...",

+ 28 - 4
pages/workOrder/detail.vue

@@ -167,9 +167,10 @@
                 <view class="but-box-item">
                     <My-button :disabled="detail.status == '提交'" @onClick="submit" text="确认完工" />
                 </view>
-                <view class="but-box-item" v-if="detail.needcode">
-                    <My-button @onClick="openModal" :disabled="detail.status == '进行中'" text="客户确认码" />
+                <view class="but-box-item">
+                    <My-button  @onClick="wangong" text="完工" />
                 </view>
+                <My-button @onClick="openModal" :disabled="detail.status == '进行中'" text="客户确认码" />
             </view>
         </view>
     </view>
@@ -184,6 +185,7 @@ import { onLoad, onShow, onUnload } from '@dcloudio/uni-app';
 import nodes from './modules/nodes.vue';
 import VCode from './modules/vCode.vue';
 
+
 // 验证码相关
 const Code = ref(null);
 function openModal() {
@@ -206,6 +208,28 @@ onLoad((options) => {
     sa_workorderid = options.id;
 });
 
+function wangong() {
+    $Http.basic({
+        "id": "20230209144903",
+        "content": { sa_workorderid }
+    }).then(res => {
+        console.log("完结工单", res)
+        if (res.code == 1) {
+            uni.showToast({
+                title: '工单成功完结',
+                icon: 'none'
+            });
+        } else {
+            uni.showToast({
+                title: res.msg,
+                icon: 'none'
+            });
+            uModal.value.loading = false;
+        }
+    })
+}
+
+
 onUnload(() => {
     delete $Http.content1
 });
@@ -242,7 +266,7 @@ function getDetail() {
         try {
             res.data.inqualityguaranteeperiod = new Date() >= new Date(res.data.cardbegdate) && new Date() <= new Date(res.data.cardenddate);
         } catch (error) {
-            
+
         }
 
         if (res.data.status == '进行中' && detail.servicetype == '') transition.value = false;
@@ -287,7 +311,7 @@ function isAllNodesCompleted() {
 
 // 提交工单
 function submit() {
-    if (isAllNodesCompleted()) uni.showModal({
+    uni.showModal({
         confirmText: '继续提交',
         content: '请确认工单内容,提交后不可修改!',
         success: ({ confirm }) => {