Browse Source

工单详情待接单完成

xiaohaizhao 2 months ago
parent
commit
06284f2bb0
6 changed files with 345 additions and 46 deletions
  1. 4 0
      App.vue
  2. 4 1
      pages.json
  3. 5 2
      pages/index/home.vue
  4. 35 34
      pages/login/login.vue
  5. 264 3
      pages/workOrder/detail.vue
  6. 33 6
      pages/workOrder/index.vue

+ 4 - 0
App.vue

@@ -39,4 +39,8 @@ export default {
 /* 注意要写在第一行,注意不能引入至uni.scss,同时给style标签加入lang="scss"属性 */
 @import "@/uni_modules/uview-plus/index.scss";
 @import '/static/iconfont.css';
+
+page {
+	background-color: #F7F7FF;
+}
 </style>

+ 4 - 1
pages.json

@@ -19,7 +19,10 @@
 			"path": "pages/workOrder/index"
 		},
 		{
-			"path": "pages/workOrder/detail"
+			"path": "pages/workOrder/detail",
+			"style": {
+				"navigationBarTitleText": "工单详情"
+			}
 		}
 	],
 	"globalStyle": {

+ 5 - 2
pages/index/home.vue

@@ -30,7 +30,7 @@
 
 <script setup>
 import { ref, getCurrentInstance, computed } from 'vue'
-import { onLoad } from '@dcloudio/uni-app';
+import { onLoad, onShow } from '@dcloudio/uni-app';
 const { $Http } = getCurrentInstance().proxy;
 const banner = ref([]);
 const enterprisename = ref('');
@@ -38,6 +38,10 @@ const welcomeText = computed(() => {
 	return getTimeGreeting() + ',' + (uni.getStorageSync('userMsg').name);
 });
 
+onShow(() => {
+	uploadNumber()
+})
+
 function getTimeGreeting() {
 	const hour = new Date().getHours();
 
@@ -84,7 +88,6 @@ onLoad(() => {
 		}
 	})
 
-	uploadNumber()
 	$Http.uploadNumber = uploadNumber;
 });
 

+ 35 - 34
pages/login/login.vue

@@ -1,43 +1,45 @@
 <template>
-    <view class="head-image">
-        <image src="/static/image/logo1.png" mode="heightFix" />
-    </view>
-    <view class="input-box">
-        <view class="content">
-            <picker class="picker" mode="selector" :range="countryCodes" range-key="name" :value="countryCode"
-                @change="changeCountryCode">
-                {{ countryCode }}
-            </picker>
-            <input type="number" :value="phonenumber" :focus="focused == 'phonenumber'"
-                @input="onInput($event, 'phonenumber')" placeholder="请输入手机号" class="input" />
+    <view style="height: 100vh;width: 100vw;background-color: #fff;padding-top: 120rpx;box-sizing: border-box;">
+        <view class="head-image">
+            <image src="/static/image/logo1.png" mode="heightFix" />
         </view>
-    </view>
-    <view class="input-box" style="margin-top:70rpx;">
-        <view class="content">
-            <input type="number" :value="password" :focus="focused == 'password'" @input="onInput($event, 'password')"
-                placeholder="请输入验证码" class="input" />
-            <view class="auth-code" @click="getAuthCode">
-                {{ downTime == 0 ? '获取验证码' : downTime + "S" }}
+        <view class="input-box">
+            <view class="content">
+                <picker class="picker" mode="selector" :range="countryCodes" range-key="name" :value="countryCode"
+                    @change="changeCountryCode">
+                    {{ countryCode }}
+                </picker>
+                <input type="number" :value="phonenumber" :focus="focused == 'phonenumber'"
+                    @input="onInput($event, 'phonenumber')" placeholder="请输入手机号" class="input" />
             </view>
         </view>
-    </view>
-    <My-button :customStyle="customStyle" class="my-but" :loading="loading" :disabled="disabled" text="登录"
-        :onClick="logIn" />
-    <view class="agreement-box">
-        <up-checkbox label="已阅读并同意" name="agree" usedAlone v-model:checked="isAgreement" />
-        <view @click="checkTheAgreement" style="color: #3874F6;">
-            《隐私协议》
+        <view class="input-box" style="margin-top:70rpx;">
+            <view class="content">
+                <input type="number" :value="password" :focus="focused == 'password'"
+                    @input="onInput($event, 'password')" placeholder="请输入验证码" class="input" />
+                <view class="auth-code" @click="getAuthCode">
+                    {{ downTime == 0 ? '获取验证码' : downTime + "S" }}
+                </view>
+            </view>
+        </view>
+        <My-button :customStyle="customStyle" class="my-but" :loading="loading" :disabled="disabled" text="登录"
+            :onClick="logIn" />
+        <view class="agreement-box">
+            <up-checkbox label="已阅读并同意" name="agree" usedAlone v-model:checked="isAgreement" />
+            <view @click="checkTheAgreement" style="color: #3874F6;">
+                《隐私协议》
+            </view>
         </view>
-    </view>
 
-    <up-modal 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>
+        <up-modal 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>
 
-    <!-- 正式无需使用 -->
-    <up-picker title="选择站点" :show="account_list.length != 0" :columns="account_list" keyName="sitename"
-        @cancel="onCancel" @confirm='onConfirm' />
+        <!-- 正式无需使用 -->
+        <up-picker title="选择站点" :show="account_list.length != 0" :columns="account_list" keyName="sitename"
+            @cancel="onCancel" @confirm='onConfirm' />
+    </view>
 </template>
 
 <script setup>
@@ -374,7 +376,6 @@ function str2binl(str) {
     display: flex;
     justify-content: center;
     height: 148rpx;
-    margin-top: 120rpx;
     margin-bottom: 120rpx;
 
     image {

+ 264 - 3
pages/workOrder/detail.vue

@@ -1,11 +1,272 @@
 <template>
-    <view>
-        详情
+    <view style="background-color: #fff;padding: 20rpx 0;">
+        <up-steps :current="current" dot activeColor="#0279FE">
+            <up-steps-item v-for="item in steps" :key="item.title" :title="item.title" />
+        </up-steps>
+    </view>
+    <view class="main">
+        <view class="billno" style="margin-bottom: -24rpx;">
+            工单编号:{{ detail.billno }}
+        </view>
+        <view class="row">
+            <view class="label col-center">服务类型</view>
+            <view class="servicetype"
+                :style="{ 'background': { '安装': '#70B603', '维修': '#D9001B', '清洁': '#3874F6' }[detail.servicetype] || '#999999' }">
+                {{ detail.servicetype || '--' }}</view>
+        </view>
+        <view class="row">
+            <view class="label">产品品类</view>
+            <view class="value">{{ detail.class1 || '--' }}</view>
+        </view>
+        <view class="row" v-if="detail.servicetype == '维修'">
+            <view class="label">故障类型</view>
+            <view class="value">{{ detail.reason || '--' }}</view>
+        </view>
+        <view class="row">
+            <view class="label">服务地址</view>
+            <view class="value">{{ detail.province + detail.city + detail.county + detail.address || '--' }}</view>
+        </view>
+        <view class="row" style="align-items: center;">
+            <view class="label justify">联系人</view>
+            <view class="value phonenumber">{{ detail.scenecontact || '--' }}
+                <block v-if="detail.scenecontactphonenumber">
+                    <text style="margin: 0 20rpx 0 10rpx;">
+                        {{ detail.scenecontactphonenumber }}
+                    </text>
+                    <My-button :customStyle="{
+                        width: '142rpx',
+                        height: '48rpx',
+                        'background-color': '#FFFFFF',
+                        'color': '#3874F6',
+                        borderRadius: '10rpx'
+                    }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="detail.scenecontactphonenumber" />
+                </block>
+            </view>
+        </view>
+        <view class="row">
+            <view class="label">派单日期</view>
+            <view class="value">{{ detail.createdate || '--' }}</view>
+        </view>
+        <view class="row">
+            <view class="label">服务需求</view>
+            <view class="value">{{ detail.remarks || '--' }}</view>
+        </view>
+        <up-divider />
+        <view class="row" v-if="detail.enterprisename">
+            <view class="label justify">销售商</view>
+            <view class="value">{{ detail.enterprisename || '--' }}</view>
+        </view>
+        <view class="row" v-if="detail.itemsText.length">
+            <view class="label">产品信息</view>
+            <view class="value">
+                <view class="col-center" v-for="(item, index) in detail.itemsText" :key="index">
+                    <view class="value"><text v-if="detail.itemsText.length != 1">{{ index + 1 }}. </text>{{ item }}
+                    </view>
+                </view>
+            </view>
+        </view>
+        <view class="row" v-if="detail.sku">
+            <view class="label justify">序列号</view>
+            <view class="value">{{ detail.sku || '--' }}</view>
+        </view>
+        <view class="row" v-if="detail.customername || detail.customerphonenumber" style="align-items: center;">
+            <view class="label justify">客户信息</view>
+            <view class="value phonenumber">{{ detail.customername || '' }}
+                <block v-if="detail.customerphonenumber">
+                    <text style="margin: 0 20rpx 0 10rpx;">
+                        {{ detail.customerphonenumber }}
+                    </text>
+                    <My-button :customStyle="{
+                        width: '142rpx',
+                        height: '48rpx',
+                        'background-color': '#FFFFFF',
+                        'color': '#3874F6',
+                        borderRadius: '10rpx'
+                    }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="detail.customerphonenumber" />
+                </block>
+            </view>
+        </view>
+        <view class="row" v-if="detail.servicetype !== '安装' && detail.cardno">
+            <view class="label">保修信息</view>
+            <view class="value">
+                <text :style="{ color: detail.inqualityguaranteeperiod ? '#70B603' : '#D9001B' }"
+                    style="margin-right: 0rpx;">
+                    {{ detail.inqualityguaranteeperiod ? '在保' : '已过保' }}
+                </text>
+                {{ detail.cardno || '' }}
+                <view v-if="detail.cardno" style="margin-top: 20rpx;">
+                    {{ item.begdate || '' }} - {{ item.enddate || '' }}
+                </view>
+            </view>
+        </view>
+        <!-- 底部按钮 -->
+        <view v-if="detail.status == '待接单'" class="but-box">
+            <view class="but-box-item" v-if="detail.customerphonenumber">
+                <My-button :customStyle="{
+                    'background-color': '#FFFFFF',
+                    'color': '#3874F6',
+                }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="detail.customerphonenumber" />
+            </view>
+            <view class="but-box-item" @click="takeOrderShow = true">
+                <My-button frontIcon="icon-dianhua" text="接单" />
+                <up-modal :show="takeOrderShow" title="是否确认接单?" showCancelButton @confirm="takeOrders"
+                    @cancel="takeOrderShow = false" ref="uModal" :asyncClose="true"></up-modal>
+            </view>
+        </view>
     </view>
 </template>
 
 <script setup>
+import { ref, reactive, getCurrentInstance } from 'vue';
+const { $Http } = getCurrentInstance().proxy;
+import { onLoad } from '@dcloudio/uni-app';
+
+const current = ref(-1);
+const steps = reactive([
+    { title: '接单', value: '待接单' },
+    { title: '开始', value: '待开始' },
+    { title: '进行中', value: '进行中' },
+    { title: '提交', value: '提交' },
+    { title: '完工', value: '已完成' }
+]);
+let sa_workorderid = 0;
+onLoad((options) => {
+    sa_workorderid = options.id;
+    getDetail()
+});
+let detail = reactive({
+    itemsText: []
+});
+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' });
+        res.data.itemsText = res.data.titems.map(item => {
+            return `${item.itemname} ${item.model}`;
+        })
+        detail = reactive(res.data);
+        current.value = steps.findIndex(item => item.value === res.data.status);
+    })
+}
+
+
+// 接单
+let takeOrderShow = ref(false);
 
+function takeOrders() {
+    $Http.basic({
+        id: 20230210101103,
+        "content": {
+            "sa_workorderid": detail.sa_workorderid
+        }
+    }).then(res => {
+        console.log("接单结果", res)
+        if (res.code == 1) {
+            takeOrderShow.value = false;
+            getDetail();
+            uni.showToast({
+                title: '接单成功',
+                icon: 'none'
+            });
+        } else {
+            if (res.msg) uni.showToast({
+                title: res.msg,
+                icon: 'none'
+            });
+        }
+    })
+}
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.main {
+    width: 690rpx;
+    background: #FFFFFF;
+    box-shadow: 0rpx 4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    border-radius: 10rpx;
+    box-sizing: border-box;
+    padding: 40rpx;
+    margin: 40rpx auto 0;
+    overflow: hidden;
+
+    .row {
+        display: flex;
+        font-size: 28rpx;
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        line-height: 32rpx;
+        margin-top: 20rpx;
+
+        .label {
+            position: relative;
+            width: 108rpx;
+            color: #999999;
+            box-sizing: border-box;
+            flex-shrink: 0;
+            margin-right: 30rpx;
+        }
+
+        .label::after {
+            position: absolute;
+            top: 0;
+            right: -12rpx;
+            content: ':';
+        }
+
+        .value {
+            color: #333333;
+        }
+
+        .phonenumber {
+            width: 100%;
+            display: flex;
+            align-items: center;
+        }
+
+        .servicetype {
+            border-radius: 8rpx;
+            padding: 8rpx 16rpx;
+            font-weight: bold;
+            color: #fff;
+        }
+    }
+
+    .col-center {
+        display: flex;
+        align-items: center;
+    }
+
+    .col-center::after {
+        top: 50% !important;
+        transform: translateY(-50%);
+    }
+
+    .justify {
+        text-align: justify;
+        text-align-last: justify;
+    }
+
+    .billno {
+        position: relative;
+        width: 400rpx;
+        top: -40rpx;
+        left: -40rpx;
+        background: #3874F6;
+        border-radius: 0 0rpx 24rpx 0rpx;
+        padding: 10rpx 52rpx 10rpx 20rpx;
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        font-size: 26rpx;
+        color: #FFFFFF;
+    }
+}
+
+.but-box {
+    display: flex;
+    align-items: center;
+    justify-content: space-around;
+    margin-top: 40rpx;
+
+    .but-box-item {
+        width: 45%;
+    }
+}
+</style>

+ 33 - 6
pages/workOrder/index.vue

@@ -1,8 +1,18 @@
 <template>
+    <view v-if="!['待接单', '已完成'].includes(content.where.status)" style="background-color: #fff;">
+        <up-tabs lineColor="#3874F6" :scrollable="false" :list="[{
+            name: '待开始'
+        }, {
+            name: '进行中'
+        }, {
+            name: '已提交',
+            value: '提交'
+        }]" @click="tabClick" />
+    </view>
     <My_listbox ref="listBox" :empty="!list.length" @getlist="getList">
         <view style="height: 18rpx;" />
-        <navigator class="item" v-for="item in list" :key="item.sa_workorderid" url="/pages/workOrder/detail"
-            hover-class="navigator-hover">
+        <navigator class="item" v-for="item in list" :key="item.sa_workorderid"
+            :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' }">
@@ -18,7 +28,7 @@
             <view class="user">
                 {{ item.customername + ' ' + item.customerphonenumber }}
             </view>
-            <view class="but-box" @click.stop>
+            <view v-if="content.where.status != '已完结'" class="but-box" @click.stop>
                 <view class="but-box-item">
                     <My-button :customStyle="{
                         'background-color': '#FFFFFF',
@@ -26,11 +36,16 @@
                         height: '70rpx',
                     }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="item.customerphonenumber" />
                 </view>
-                <view class="but-box-item" @click="openModel(item)">
+                <view v-if="content.where.status == '待接单'" class="but-box-item" @click="openModel(item)">
                     <My-button :customStyle="{
                         height: '70rpx',
                     }" frontIcon="icon-dianhua" text="接单" />
                 </view>
+                <navigator v-else :url="'/pages/workOrder/detail?id=' + item.sa_workorderid" class="but-box-item">
+                    <My-button :customStyle="{
+                        height: '70rpx',
+                    }" frontIcon="icon-dianhua" text="报工" />
+                </navigator>
             </view>
         </navigator>
     </My_listbox>
@@ -42,7 +57,8 @@
 <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 listBox = ref(null);
 const content = reactive({
     isadmin: 1,
@@ -55,28 +71,39 @@ const content = reactive({
 });
 const list = ref([])
 
+function tabClick(e) {
+    content.where.status = e.value || e.name;
+    getList(true);
+}
+
 onLoad((options) => {
-    content.where.status = options.type;
     switch (options.type) {
         case '待接单':
             uni.setNavigationBarTitle({
                 title: '待接工单'
             });
+            content.where.status = options.type;
             break;
         case '进行中':
             uni.setNavigationBarTitle({
                 title: '进行中工单'
             });
+            content.where.status = '待开始';
             break;
         case '已完结':
             uni.setNavigationBarTitle({
                 title: '已完结工单'
             });
+            content.where.status = '已完成';
             break;
     }
     getList();
 });
 
+onShow(() => {
+    if (content.pageNumber != 1) $Http.updateList(content, getList)
+})
+
 function getList(init = false) {
     if (init) content.pageNumber = 1;
     $Http.basic({