|
|
@@ -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
|
|
|
}
|
|
|
})
|
|
|
}
|