xiaohaizhao 2 viikkoa sitten
vanhempi
commit
0bf03444af

+ 4 - 1
pages/select/accessoriesList.vue

@@ -16,7 +16,7 @@
                     分类:{{ item.bomfullname || '--' }}
                 </view>
                 <view class="row">
-                    售价:<text class="price">{{ item.price }}</text>
+                    售价:<text class="price">{{ $Http.formatNumber(item.price) }}</text>
                 </view>
             </view>
         </view>
@@ -27,6 +27,9 @@
 import { defineProps, defineEmits } from 'vue';
 const emit = defineEmits(['uploadCallback'])
 
+import { getCurrentInstance } from 'vue';
+const { $Http } = getCurrentInstance().proxy;
+
 const props = defineProps({
     list: {
         type: Array

+ 9 - 1
pages/workOrder/changeMsg.vue

@@ -266,17 +266,23 @@ function skuConfirm() {
         ['serviceenterprisename', "customername", 'customerphonenumber', 'sa_customersid', 'cardno', 'itemid', 'itemname', 'itemno', 'model', 'phonenumber', 'unitname', 'spec'].forEach(key => {
             form[key] = '';
         });
+        if (form.sku.length < 3) {
+            querySku.value = false;
+            return uni.showToast({ title: '请输入正确的序列号', icon: 'none' });
+        }
+        uni.showLoading({ title: '查询中...' });
         $Http.basic({
             "id": 2025080813465203,
             "content": {
                 "pageNumber": 1,
                 "pageSize": 1,
                 "where": {
-                    condition: form.sku,
+                    sku: form.sku,
                 }
             }
         }).then(res => {
             console.log(res)
+            uni.hideLoading();
             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' });
@@ -334,6 +340,7 @@ function phonenumberConfirm() {
     if (!phoneRegex.test(form.customerphonenumber)) {
         return uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
     }
+    uni.showLoading({ title: '查询中...' });
     $Http.basic({
         "id": 2025080813465203,
         "content": {
@@ -344,6 +351,7 @@ function phonenumberConfirm() {
             }
         }
     }).then(res => {
+        uni.hideLoading();
         console.log("根据用户手机查询", res)
         if (res.code !== 1) return uni.showToast({ title: res.msg, icon: 'none' });
         if (res.data.length === 0) return uni.showToast({ title: '未找到对应的客户信息', icon: 'none' });

+ 5 - 2
pages/workOrder/detail.vue

@@ -124,7 +124,7 @@
                     }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="detail.customerphonenumber" />
                 </view>
                 <view class="but-box-item" @click="takeOrderShow = true">
-                    <My-button frontIcon="icon-dianhua" text="接单" />
+                    <My-button frontIcon="icon-jiedan" text="接单" />
                     <up-modal negativeTop="100" :show="takeOrderShow" title="是否确认接单?" showCancelButton
                         @confirm="takeOrders" @cancel="takeOrderShow = false" ref="uModal"
                         :asyncClose="true"></up-modal>
@@ -270,7 +270,10 @@ function submit() {
                             title: res.code == 1 ? '提交成功' : res.msg,
                             icon: 'none'
                         });
-                        if (res.code == 1) getDetail();
+                        if (res.code == 1) {
+                            getDetail();
+                            transition.value = true;
+                        }
                     })
                 }
             },

+ 2 - 2
pages/workOrder/index.vue

@@ -39,12 +39,12 @@
                 <view v-if="content.where.status == '待接单'" class="but-box-item" @click="openModel(item)">
                     <My-button :customStyle="{
                         height: '70rpx',
-                    }" frontIcon="icon-dianhua" text="接单" />
+                    }" frontIcon="icon-jiedan" 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="报工" />
+                    }" frontIcon="icon-jiedan" text="报工" />
                 </navigator>
             </view>
         </navigator>

+ 10 - 3
pages/workOrder/modules/products.vue

@@ -1,6 +1,7 @@
 <template>
     <up-swipe-action>
-        <up-swipe-action-item v-for="item in list" :key="item.itemid" :options="options1" @click="onClick(item)">
+        <up-swipe-action-item :disabled="disabled" v-for="item in list" :key="item.itemid" :options="options1"
+            @click="onClick(item)">
             <view class="item">
                 <view class="left" @click.stop="previewImge(item.imageUrl)">
                     <up-image :show-loading="true" :src="item.imageUrl" width="100%" height="100%" />
@@ -16,10 +17,10 @@
                         型号:{{ item.model || '--' }}
                     </view>
                     <view class="row">
-                        售价:<text class="price">{{ item.price }}</text>
+                        售价:<text class="price">{{ $Http.formatNumber(item.price) }}</text>
                     </view>
                     <view class="number">
-                        <up-number-box v-model="item.qty" @change="valChange" />
+                        <up-number-box :disabled="disabled" v-model="item.qty" @change="valChange" />
                     </view>
                 </view>
             </view>
@@ -29,6 +30,8 @@
 
 <script setup>
 import { defineProps, defineEmits, ref, reactive } from 'vue';
+import { getCurrentInstance } from 'vue';
+const { $Http } = getCurrentInstance().proxy;
 const emits = defineEmits(['deleteItem']);
 const props = defineProps({
     list: {
@@ -36,6 +39,10 @@ const props = defineProps({
     },
     deleteItem: {
         type: Function
+    },
+    disabled: {
+        type: Boolean,
+        default: false
     }
 });
 

+ 17 - 20
pages/workOrder/work.vue

@@ -48,7 +48,8 @@
                             </view>
                         </view>
                     </up-form-item>
-                    <accList :list="data.newtitems" @deleteItem="deleteItem($event, 'newtitems')" />
+                    <accList :list="data.newtitems" :disabled="data.status == 1"
+                        @deleteItem="deleteItem($event, 'newtitems')" />
 
                     <up-form-item :label="`旧配件(${data.oldtitems.length})`">
                         <view class="options-box">
@@ -57,7 +58,8 @@
                             </view>
                         </view>
                     </up-form-item>
-                    <accList :list="data.oldtitems" @deleteItem="deleteItem($event, 'oldtitems')" />
+                    <accList :list="data.oldtitems" :disabled="data.status == 1"
+                        @deleteItem="deleteItem($event, 'oldtitems')" />
                 </block>
             </view>
 
@@ -85,6 +87,8 @@
                 :required="rules.fileupload[0].required">
                 <My_upload :disabled="data.status == 1" ref="upload" :fileList="data.attinfos"
                     @uploadCallback="uploadCallback" />
+                <up-image v-if="data.status == 1 && data.attinfos.length == 0" :show-loading="true" src="" width="80px"
+                    height="80px" @click="click"></up-image>
             </up-form-item>
 
             <up-form-item v-if="workpresetjson.textedit != 0" label="文字说明" prop="textedit"
@@ -331,8 +335,7 @@ function submit() {
     if (loading.value) return;
     if (upload.value.isUploading()) return;
 
-    let traintitem = [],
-        newtitems = [];
+    let traintitem = []
     try {
         if (form.additem == 1) {
             traintitem = data.oldtitems.map(v => {
@@ -343,25 +346,24 @@ function submit() {
                     price: v.price,
                     qty: v.qty || v.packageqty || 1,
                 }
-            })
-
-            newtitems = data.newtitems.map(v => {
+            }).concat(data.newtitems.map(v => {
                 return {
                     itemid: v.itemid,
                     itemname: v.itemname,
                     model: v.model,
                     price: v.price,
                     qty: v.qty || v.packageqty || 1,
+                    isnew: 1
                 }
-            })
+            }))
         } else {
             traintitem = []
-            newtitems = []
         }
     } catch (error) {
 
     }
 
+
     uFormRef.value.validate().then(valid => {
         if (valid) {
             let content = {
@@ -369,8 +371,7 @@ function submit() {
                 "sa_workorder_nodeid": data.sa_workorder_nodeid,
                 isconfirm: 1,
                 ...formToContent(form),
-                traintitem,
-                newtitems
+                traintitem
             };
             uni.showModal({
                 title: '提示',
@@ -414,8 +415,7 @@ function save() {
     if (loading1.value) return;
     if (upload.value.isUploading()) return;
 
-    let traintitem = [],
-        newtitems = [];
+    let traintitem = []
     try {
         if (form.additem == 1) {
             traintitem = data.oldtitems.map(v => {
@@ -426,20 +426,18 @@ function save() {
                     price: v.price,
                     qty: v.qty || v.packageqty || 1,
                 }
-            })
-
-            newtitems = data.newtitems.map(v => {
+            }).concat(data.newtitems.map(v => {
                 return {
                     itemid: v.itemid,
                     itemname: v.itemname,
                     model: v.model,
                     price: v.price,
                     qty: v.qty || v.packageqty || 1,
+                    isnew: 1
                 }
-            })
+            }))
         } else {
             traintitem = []
-            newtitems = []
         }
     } catch (error) {
 
@@ -451,8 +449,7 @@ function save() {
         "sa_workorder_nodeid": data.sa_workorder_nodeid,
         isconfirm: 0,
         ...formToContent(form),
-        traintitem,
-        newtitems
+        traintitem
     };
 
     loading1.value = true;

+ 7 - 0
utils/Http.js

@@ -17,6 +17,13 @@ class HTTP {
             getList()
         }
 
+        this.formatNumber = (num, decimalPlaces = 2) => {
+            if (!num && num !== 0) return '';
+            let [integer, decimal] = String(num.toFixed(decimalPlaces)).split('.');
+            integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
+            return decimal ? `${integer}.${decimal}` : integer;
+        }
+
         //得到缩略图或者压缩图  getType默认得到缩略图传true得到压缩图
         this.getSpecifiedImage = (obj, getType = false) => {
             try {