xiaohaizhao 4 месяцев назад
Родитель
Сommit
5b45c00660

+ 11 - 1
components/My_listbox/My_listbox.vue

@@ -64,6 +64,15 @@ const refreshToComplete = () => {
     }, 500)
 }
 
+// 回到顶部
+const backToTop = () => {
+    scrollIntoView.value = "header"
+    // 清除标记,避免重复触发
+    setTimeout(() => {
+        scrollIntoView.value = ""
+    }, 300)
+}
+
 /* 加载分页 */
 const loadThePage = () => {
     emit("getlist", false)
@@ -143,7 +152,8 @@ onMounted(() => {
 // 使用 defineExpose 暴露方法给父组件
 defineExpose({
     refreshToComplete,
-    setHeight
+    setHeight,
+    backToTop
 })
 </script>
 

+ 70 - 1
pages/generalServices/detail.vue

@@ -69,6 +69,10 @@
             <view class="label">服务需求</view>
             <view class="value">{{ detail.remarks || '--' }}</view>
         </view>
+        <view class="row" v-if="detail.voidreason">
+            <view class="label">作废原因</view>
+            <view class="value">{{ detail.voidreason || '--' }}</view>
+        </view>
         <view class="transition">
             <up-divider />
             <view class="row" v-if="detail.sku">
@@ -151,14 +155,32 @@
             </view>
             <view class="but-box" v-else-if="detail.status == '已完结'">
             </view>
-            <view class="but-box" v-else>
+            <view class="but-box" v-else-if="detail.status != '作废'">
                 <view class="but-box-item">
                     <My-button :text="detail.status == '待分配' ? '分配' : '重新指派'" @onClick="changeUser" />
                 </view>
+                <view v-if="userInfo.sys_enterpriseid == detail.sys_enterpriseid_initiate"
+                    class="but-box-item">
+                    <My-button :customStyle="{
+                        'background-color': '#FFFFFF',
+                        'color': '#3874F6',
+                    }" text="作废" @onClick="openCancelled" />
+                </view>
             </view>
         </block>
+        <view v-else-if="userInfo.sys_enterpriseid == detail.sys_enterpriseid_initiate && detail.status != '作废'"
+            style="padding: 20rpx 16rpx;" class="but-box-item">
+            <My-button text="作废" @onClick="openCancelled" />
+        </view>
     </view>
 
+    <up-modal :show="cancelled" title="作废说明" showCancelButton @confirm="confirmClose
+    " ref="uModal1" :asyncClose="true" @cancel="cancelled = false">
+        <view style="width: 99%;">
+            <up-textarea v-model="voidreason" placeholder="作废说明" count></up-textarea>
+        </view>
+    </up-modal>
+
     <view class="main" v-if="time && workDetail.nodes.length">
         <Nodes ref="Nodes" status="已完结" :nodes="workDetail.nodes" />
     </view>
@@ -353,6 +375,53 @@ function deleteItem() {
     });
 }
 
+let cancelled = ref(false),
+    voidreason = ref(""),
+    uModal1 = ref(null);
+
+function openCancelled() {
+    cancelled.value = true;
+}
+
+function confirmClose() {
+    if (voidreason.value.trim() == "") {
+        uni.showToast({
+            title: '请输入作废说明',
+            icon: 'none'
+        });
+        uModal1.value.loading = false;
+        return;
+    };
+    uni.showModal({
+        title: '提示',
+        content: "请注意:操作作废后,对应的服务工单与保修卡号将同步作废,是否确认继续?",
+        confirmText: '确认作废',
+        success: function ({ confirm }) {
+            if (confirm) voidFunc();
+            else uModal1.value.loading = false;
+        }
+    });
+
+
+}
+function voidFunc() {
+    $Http.basic({
+        "id": 2025121519311203,
+        "content": {
+            sa_serviceorderid: sa_serviceorderid,
+            "voidreason": voidreason.value
+        }
+    }).then(res => {
+        console.log("作废", res)
+        uni.showToast({ title: res.code !== 1 ? res.msg : '作废成功', icon: 'none', mask: res.code === 1 });
+        if (res.code !== 1) return uModal1.value.loading = false;
+        cancelled.value = false;
+        setTimeout(() => {
+            uni.navigateBack();
+        }, 300)
+    })
+}
+
 defineExpose({ detail })
 </script>
 

+ 31 - 16
pages/launchApplication/index.vue

@@ -329,29 +329,44 @@ function skuConfirm() {
     if (form.sku) {
         if (form.sku == '') return;
         querySkuing = true;
+
         $Http.basic({
-            "id": 20221215101003,
+            "id": 2025121515015903,
             "content": {
-                "where": {
-                    "sku": form.sku
-                }
+                "sku": form.sku
             }
-        }).then(res => {
-            console.log("查询sku", res)
-            uni.hideLoading();
-            if (res.code !== 1) {
-                uni.showToast({ title: res.msg, icon: 'none' })
+        }).then(s => {
+            console.log("预查询sku", s)
+            if (s.code !== 1) {
+                uni.showToast({ title: s.msg, icon: 'none' })
                 form.sku = '';
                 querySkuing = false;
                 return
             };
-            if (res.data.length === 0 || res.data[0].sku !== form.sku) {
-                uni.showToast({ title: '未查询到对应的产品信息,请确认序列号是否正确', icon: 'none' });
-                form.sku = '';
-                querySkuing = false;
-                return;
-            }
-            changeItem(res.data[0]);
+            $Http.basic({
+                "id": 20221215101003,
+                "content": {
+                    "where": {
+                        "sku": form.sku
+                    }
+                }
+            }).then(res => {
+                console.log("查询sku", res)
+                uni.hideLoading();
+                if (res.code !== 1) {
+                    uni.showToast({ title: res.msg, icon: 'none' })
+                    form.sku = '';
+                    querySkuing = false;
+                    return
+                };
+                if (res.data.length === 0 || res.data[0].sku !== form.sku) {
+                    uni.showToast({ title: '未查询到对应的产品信息,请确认序列号是否正确', icon: 'none' });
+                    form.sku = '';
+                    querySkuing = false;
+                    return;
+                }
+                changeItem(res.data[0]);
+            })
         })
     } else {
         form.sku = '';

+ 39 - 37
pages/skus/index.vue

@@ -1,4 +1,11 @@
 <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="background-color: #fff;">
         <up-tabs lineColor="#3874F6" :current="current" :scrollable="false" :list="tabList" @click="tabClick" />
     </view>
@@ -8,7 +15,7 @@
             :key="item.itemid">
             <view class="image-box">
                 <up-image :show-loading="true" :src="item.cover" width="80px" height="80px" />
-                <view class="tag"  v-if="item.cardno && item.isvoid" :style="{
+                <view class="tag" v-if="item.cardno && item.isvoid" :style="{
                     background: item.isUnderWarranty ? '#27D8B4' : '#E14154',
                 }">
                     {{ item.isUnderWarranty ? '在' : '过' }}保
@@ -57,9 +64,6 @@
         </view>
         <view style="height: 30px;" />
     </My_listbox>
-
-    <up-modal negativeTop="100" :show="takeOrderShow" title="是否确认接单?" showCancelButton @confirm="takeOrders"
-        @cancel="takeOrderShow = false" ref="uModal" :asyncClose="true"></up-modal>
 </template>
 
 <script setup>
@@ -80,6 +84,14 @@ const content = reactive({
 });
 const list = ref([])
 
+const keyword = ref('');
+function onSearch(e) {
+    if (content.where.condition == e) return;
+    content.where.condition = e;
+    keyword.value = e;
+    getList(true);
+}
+
 let tabList = ref([
     {
         name: '未安装',
@@ -93,8 +105,9 @@ let tabList = ref([
     current = ref(0);
 
 function tabClick(e) {
-    content.where.isvoid = e.value || e.name;
+    content.where.isvoid = e.value;
     getList(true);
+    listBox.value.backToTop()
 }
 
 function callPhone(phone) {
@@ -112,18 +125,15 @@ function callPhone(phone) {
 
 onLoad((options) => {
     getList();
-    // getBadge();
 });
 
 onShow(() => {
     if (content.pageNumber != 1) {
         $Http.updateList(content, getList)
-        // getBadge();
     }
 })
 
 function createdServices(item) {
-    console.log(item)
     uni.navigateTo({
         url: '/pages/launchApplication/index?sku=' + item.sku,
     });
@@ -141,16 +151,22 @@ function getList(init = false) {
         content.loading = false;
         listBox.value.refreshToComplete();
         listBox.value.setHeight();
-        res.data = res.data.map(v => {
-            v.isUnderWarranty = new Date() >= new Date(v.begdate) && new Date() <= new Date(v.enddate);
-            try {
-                v.cover = v.attinfos.length ? $Http.getSpecifiedImage(v.attinfos[0]) : ''
-            } catch (error) {
+        if (res.code == 1) {
+            res.data = res.data.map(v => {
+                v.isUnderWarranty = new Date() >= new Date(v.begdate) && new Date() <= new Date(v.enddate);
+                try {
+                    v.cover = v.attinfos.length ? $Http.getSpecifiedImage(v.attinfos[0]) : ''
+                } catch (error) {
 
+                }
+                return v
+            })
+
+            tabList.value[content.where.isvoid].badge = {
+                value: res.total
             }
-            return v
-        })
-        if (res.code == 1) {
+            getBadge();
+
             list.value = reactive(res.firstPage ? res.data : list.value.concat(res.data));
             content.pageTotal = res.pageTotal;
             content.pageNumber = res.pageNumber;
@@ -165,27 +181,13 @@ function getList(init = false) {
 
 
 function getBadge() {
-    if (!['待接单', '已完工'].includes(content.where.status)) Promise.all(
-        tabList.value.map(v =>
-            $Http.basic({
-                "id": "20230208140203", "content":
-                    { "pageNumber": 1, "pageSize": 0, "nocache": true, "where": { "status": v.value || v.name } }
-            })
-        )
-    ).then(res => {
-        let changeCurrent = false;
-        res.forEach((v, index) => {
-            let value = v.code !== 0 ? v.total : 0
-            tabList.value[index].badge = {
-                value
-            }
-            if (tabList.value[index].name == '进行中' && value == 0) changeCurrent = true;
-        })
-        if (changeCurrent) {
-            let index = tabList.value.findIndex(v => v.badge.value > 0);
-            current.value = index == -1 ? 0 : index;
-            content.where.status = tabList.value[current.value].value || tabList.value[current.value].name;
-            getList(true);
+    let isvoid = content.where.isvoid ? 0 : 1;
+    $Http.basic({
+        "id": "2025082210142103", "content":
+            { "pageNumber": 1, "pageSize": 0, "nocache": true, "where": { isvoid, condition: content.where.condition } }
+    }).then(res => {
+        if (res.code == 1) tabList.value[isvoid].badge = {
+            value: res.total
         }
     })
 }