Commit f242b1ca authored by 刘文虎's avatar 刘文虎

1.5.7版本更新 收货 盘点功能

parent aebe688a
import util from '@/utils/util.js' import util from '@/utils/util.js'
const jsonType = {'content-type': 'application/json'} const jsonType = {
const formType = {'content-type': 'application/x-www-form-urlencoded'} 'content-type': 'application/json'
const dataType = {'content-type': 'multipart/form-data'} }
const formType = {
'content-type': 'application/x-www-form-urlencoded'
}
const dataType = {
'content-type': 'multipart/form-data'
}
let inventoryApiFun = function(vm){ let inventoryApiFun = function(vm) {
// 接口公共前缀 // 接口公共前缀
let parts="/wxh-worker-rest/rest/parts/" //收货 inventory 模块 let parts = "/wxh-worker-rest/rest/parts/" //收货 inventory 模块
/** /**
* 收货列表 * 盘点列表
*/ */
let inventoryListByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/take/stock/take/stock', params); let inventoryListByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
'/take/stock/take/stock', params);
/** /**
* 收货单详情 * 盘点详情
*/ */
let inventoryDetailByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/take/stock/sign/detail/'+ params); let inventoryDetailByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
'/take/stock/detail/' + params);
/** /**
* 确认收货 * 新增盘点
*/ */
let addInventoryByInventoryModules = async (params = {}) => await vm.$u.post(parts + vm.vuex_token + '/take/stock/detail/add', params,formType); let addInventoryByInventoryModules = async (params = {}) => await vm.$u.post(parts + vm.vuex_token +
'/take/stock/detail/add', params, formType);
/**
* 删除盘点
*/
let deleteInventoryByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
'/take/stock/detail/delete/' + params);
/**
* 提交盘点
*/
let confirmInventoryByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
'/take/stock/take/submit/' + params);
/**
* 提交盘点
*/
let applyReInventoryByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
'/take/stock/take/submit/' + params);
const inventoryApi = { const inventoryApi = {
inventoryListByInventoryModules, inventoryListByInventoryModules,
inventoryDetailByInventoryModules, inventoryDetailByInventoryModules,
addInventoryByInventoryModules, addInventoryByInventoryModules,
deleteInventoryByInventoryModules,
confirmInventoryByInventoryModules,
applyReInventoryByInventoryModules
} }
return inventoryApi return inventoryApi
} }
......
// 自定义filter // 自定义filter
export function myFilter(value, options,key="label") { export function myFilter(value, options, key = "label") {
if (options && options instanceof Array) { if (options && options instanceof Array) {
let arr = options.filter(item => item.value === value) let arr = options.filter(item => item.value === value)
if (arr.length) { if (arr.length) {
...@@ -13,12 +13,12 @@ export function myFilter(value, options,key="label") { ...@@ -13,12 +13,12 @@ export function myFilter(value, options,key="label") {
} }
// showToast // showToast
export function showToast(title,mask=true) { export function showToast(title, mask = true) {
uni.showToast({ uni.showToast({
title, title,
icon: 'none', icon: 'none',
mask, mask,
duration:2000 duration: 2000
}) })
} }
...@@ -47,3 +47,11 @@ export function showModal({ ...@@ -47,3 +47,11 @@ export function showModal({
}); });
}, 1); }, 1);
} }
export function setNeedRefresh() {
var pages = getCurrentPages();
if (pages.length >= 2) {
var page = pages[pages.length - 2];
page.needRefresh = true
}
}
export const inventoryStatusOptions = [{
value: "0",
label: "盘点中",
},
{
value: "1",
label: "已提交",
},
{
value: "2",
label: "申请重盘",
},
{
value: "3",
label: "盘点完成",
},
]
export const takeDetailStatusOptions = [{
value: "0",
label: "匹配",
},
{
value: "1",
label: "已使用",
},
{
value: "2",
label: "未在库",
}
]
...@@ -7,3 +7,19 @@ export const receiveStatusOptions = [{ ...@@ -7,3 +7,19 @@ export const receiveStatusOptions = [{
value: 1 value: 1
} }
] ]
export const statusOptions = [{
label: '未使用',
value: "0"
},
{
label: '已使用',
value: "1"
}
]
export const statusColorOptions = {
"已使用": '#666666',
"匹配": '#2272ff',
"未在库": '#FA5A49'
}
<template> <template>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="fixed-button"><xh-button @handleClick="handleClick" :text="text"></xh-button></view> <view class="fixed-button"><xh-button :disabled="disabled" :text="text" @handleClick="handleClick"></xh-button></view>
</template> </template>
<script> <script>
import XhButton from "./xh-button.vue" import XhButton from './xh-button.vue';
export default { export default {
name:"FixedButton", name: 'FixedButton',
components:{ components: {
XhButton XhButton
}, },
props:{ props: {
text:{ text: {
type:String, type: String | null,
default:"提交" default: '提交'
},
disabled:{
type:Boolean,
default: false
} }
}, },
data() { data() {
...@@ -26,9 +30,9 @@ export default { ...@@ -26,9 +30,9 @@ export default {
} }
}; };
}, },
methods:{ methods: {
handleClick(){ handleClick() {
this.$emit("handleClick") this.$emit('handleClick');
} }
} }
}; };
...@@ -39,6 +43,7 @@ export default { ...@@ -39,6 +43,7 @@ export default {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
position: fixed; position: fixed;
z-index: 99999;
left: 0; left: 0;
padding: 0 30rpx; padding: 0 30rpx;
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
......
<template> <template>
<u-button class="settle-button" type="primary" shape="circle" @click="handleClick" :custom-style="buttonStyle">{{ text }}</u-button> <u-button class="settle-button" type="primary" shape="circle" @click="handleClick" :disabled="disabled" :custom-style="buttonStyle">{{ text }}</u-button>
</template> </template>
<script> <script>
...@@ -7,8 +7,12 @@ export default { ...@@ -7,8 +7,12 @@ export default {
name: 'XhButton', name: 'XhButton',
props: { props: {
text: { text: {
type: String, type: String | null,
default: '提交' default: '提交'
},
disabled:{
type:Boolean,
default: false
} }
}, },
data() { data() {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
export default { export default {
props: { props: {
customStyle: { customStyle: {
type: String, type: String|null,
default: 'background-color: #FFFFFF' default: 'background-color: #FFFFFF'
}, },
imageName: { // 图片 imageName: { // 图片
......
...@@ -388,7 +388,8 @@ ...@@ -388,7 +388,8 @@
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTitleText": "充电桩收货", "navigationBarTitleText": "充电桩收货",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"disableScroll": true
} }
}, },
......
...@@ -16,27 +16,15 @@ ...@@ -16,27 +16,15 @@
@refresherrestore="onRestore" @refresherrestore="onRestore"
enable-back-to-top enable-back-to-top
> >
<image <image class="banner-image" :src="bannerImage" @click="handleClickBanner"></image>
class="banner-image"
:src="bannerImage"
@click="handleClickBanner"
></image>
<view class="msg-view"> <view class="msg-view">
<view class="msg-title">最新消息</view> <view class="msg-title">最新消息</view>
<view class="msg-list-view"> <view class="msg-list-view">
<view <view class="msg-content" v-for="(item, index) in messageList" :key="index" @click="toNewsDetail(item)">
class="msg-content"
v-for="(item, index) in messageList"
:key="index"
@click="toNewsDetail(item)"
>
<view class="msg-content-view"> <view class="msg-content-view">
<view class="left-view"> <view class="left-view">
<image <image class="msg-icon" :src="msgStyleImage[item.is_top]"></image>
class="msg-icon"
:src="msgStyleImage[item.is_top]"
></image>
<text class="msg-text">{{ item.title }}</text> <text class="msg-text">{{ item.title }}</text>
</view> </view>
<image class="right-icon" :src="shouyeyouImage"></image> <image class="right-icon" :src="shouyeyouImage"></image>
...@@ -45,9 +33,7 @@ ...@@ -45,9 +33,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="sticky"> <view class="sticky"><text>订单推荐</text></view>
<text>订单推荐</text>
</view>
<view class="order-view"> <view class="order-view">
<!-- 入驻成功之后显示推荐订单列表 --> <!-- 入驻成功之后显示推荐订单列表 -->
<view class="order-list-view" v-if="loaded"> <view class="order-list-view" v-if="loaded">
...@@ -55,46 +41,17 @@ ...@@ -55,46 +41,17 @@
<view v-if="needSettled" class="tip-view"> <view v-if="needSettled" class="tip-view">
<image :src="weiruzhuImage" class="tip-view-image"></image> <image :src="weiruzhuImage" class="tip-view-image"></image>
<view class="tip-other">入驻后平台将向您分配或推荐订单</view> <view class="tip-other">入驻后平台将向您分配或推荐订单</view>
<u-button <u-button class="settle-button" type="primary" shape="circle" @click="immediatelyIn" :custom-style="buttonStyle">立即入驻</u-button>
class="settle-button"
type="primary"
shape="circle"
@click="immediatelyIn"
:custom-style="buttonStyle"
>
立即入驻
</u-button>
</view> </view>
<template v-else> <template v-else>
<!-- 入驻成功之后无推荐订单 --> <!-- 入驻成功之后无推荐订单 -->
<view <view v-if="orderList.length <= 0 && loadedOrder" class="no-order-view"><NoOrder /></view>
v-if="orderList.length <= 0 && loadedOrder"
class="no-order-view"
>
<NoOrder />
</view>
<view v-else-if="orderList.length > 0" class="order-item-view"> <view v-else-if="orderList.length > 0" class="order-item-view">
<view v-for="(item, index) in orderList" :key="index"> <view v-for="(item, index) in orderList" :key="index">
<OrderCell <OrderCell :orderData="item" type="waitAccept" :location="location" @click="handleClick" @action="handleClick"></OrderCell>
:orderData="item"
type="waitAccept"
:location="location"
@click="handleClick"
@action="handleClick"
>
</OrderCell>
</view> </view>
<view <view class="load-more-view" v-show="(search.pageNumber == 1 && loadedOrder) || search.pageNumber > 1">
class="load-more-view" <u-loadmore :status="currentLoadStatus" bgColor="#F4F5F7"></u-loadmore>
v-show="
(search.pageNumber == 1 && loadedOrder) ||
search.pageNumber > 1
"
>
<u-loadmore
:status="currentLoadStatus"
bgColor="#F4F5F7"
></u-loadmore>
</view> </view>
</view> </view>
</template> </template>
...@@ -110,21 +67,16 @@ ...@@ -110,21 +67,16 @@
<!-- <EusingList /> --> <!-- <EusingList /> -->
</view> </view>
<upload-progress /> <upload-progress />
<MaskTip <MaskTip :show="showMask" imageName="mengceng2.png" :imageStyle="imageStyle" name="upload_tip" />
:show="showMask"
imageName="mengceng2.png"
:imageStyle="imageStyle"
name="upload_tip"
/>
</TabBarPage> </TabBarPage>
</template> </template>
<script> <script>
import TabBarPage from '@/components/tabBarList/index.vue' import TabBarPage from '@/components/tabBarList/index.vue';
import NoOrder from '@/components/order/noOrder.vue' import NoOrder from '@/components/order/noOrder.vue';
import MaskTip from '@/components/mask-tip/index.vue' import MaskTip from '@/components/mask-tip/index.vue';
const app = getApp() const app = getApp();
import OrderCell from '@/components/order/index.vue' import OrderCell from '@/components/order/index.vue';
// import EusingList from '@/components/order/eusingList.vue' // import EusingList from '@/components/order/eusingList.vue'
export default { export default {
...@@ -132,7 +84,7 @@ export default { ...@@ -132,7 +84,7 @@ export default {
OrderCell, OrderCell,
TabBarPage, TabBarPage,
NoOrder, NoOrder,
MaskTip, MaskTip
// EusingList, // EusingList,
}, },
data() { data() {
...@@ -151,22 +103,22 @@ export default { ...@@ -151,22 +103,22 @@ export default {
search: { search: {
token: '', token: '',
pageNumber: 0, pageNumber: 0,
pageSize: 15, pageSize: 15
}, },
waitInit: false, // 当token为空时,等待自动登录结束 waitInit: false, // 当token为空时,等待自动登录结束
triggered: true, triggered: true,
scrollTop: 0, scrollTop: 0,
old: { old: {
scrollTop: 0, scrollTop: 0
}, },
showMask: false, showMask: false
} };
}, },
watch: { watch: {
vuex_token(val, oldVal) { vuex_token(val, oldVal) {
// 监听token变化,如果更新则重新加载页面数据 // 监听token变化,如果更新则重新加载页面数据
val && this.waitInit && this.getData() val && this.waitInit && this.getData();
}, }
}, },
computed: { computed: {
buttonStyle() { buttonStyle() {
...@@ -174,255 +126,235 @@ export default { ...@@ -174,255 +126,235 @@ export default {
width: '300rpx', width: '300rpx',
height: '80rpx', height: '80rpx',
'font-size': '32rpx', 'font-size': '32rpx',
'font-weight': 'bold', 'font-weight': 'bold'
} };
}, },
countKeys() { countKeys() {
return [ return ['toAppointmentCount', 'toCheckinCount', 'toFinishCount', 'reviewingCount', 'exceptionCount'];
'toAppointmentCount',
'toCheckinCount',
'toFinishCount',
'reviewingCount',
'exceptionCount',
]
}, },
msgStyleImage() { msgStyleImage() {
return { return {
'1': process.uniEnv.qn_base_url + 'zhiding.png', // 置顶 '1': process.uniEnv.qn_base_url + 'zhiding.png', // 置顶
'0': process.uniEnv.qn_base_url + 'tongzhi.png', // 通知 '0': process.uniEnv.qn_base_url + 'tongzhi.png' // 通知
// '3': process.uniEnv.qn_base_url + "xiaoxi.png", // 消息 // '3': process.uniEnv.qn_base_url + "xiaoxi.png", // 消息
} };
}, },
bannerImage() { bannerImage() {
return process.uniEnv.qn_base_url + 'banner-1.png';
return process.uniEnv.qn_base_url + 'banner-1.png'
}, },
shouyeyouImage() { shouyeyouImage() {
return process.uniEnv.qn_base_url + 'shouyeyou.png' return process.uniEnv.qn_base_url + 'shouyeyou.png';
}, },
weiruzhuImage() { weiruzhuImage() {
return process.uniEnv.qn_base_url + 'weiruzhu.png' return process.uniEnv.qn_base_url + 'weiruzhu.png';
}, },
imageStyle() { imageStyle() {
return 'width:628rpx; margin-top:816rpx; margin-left:122rpx' return 'width:628rpx; margin-top:816rpx; margin-left:122rpx';
} }
}, },
onLoad(e) { onLoad(e) {
app.trackPage('自营平台首页') app.trackPage('自营平台首页');
this._freshing = false this.freshing = false;
if (this.vuex_token) { if (this.vuex_token) {
this.getOrderCount() this.getOrderCount();
} else { } else {
this.waitInit = true this.waitInit = true;
} }
this.showMaskTip() this.showMaskTip();
}, },
onShow() { onShow() {
// 每次进入页面都刷新入驻状态 // 每次进入页面都刷新入驻状态
this.pageNumber = 0 this.pageNumber = 0;
this.initSettleInfo() this.initSettleInfo();
}, },
methods: { methods: {
getData() { getData() {
this.getOrderCount() this.getOrderCount();
this.initSettleInfo() this.initSettleInfo();
}, },
handleClick(item, type, showCountTime) { handleClick(item, type, showCountTime) {
// 跳转工单详情页面 showCountTime:是否显示倒计时 // 跳转工单详情页面 showCountTime:是否显示倒计时
// type类型 // type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息 // 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
uni.navigateTo({ uni.navigateTo({
url: url: 'pages/order/detail?id=' + item.orderId + '&type=' + type + '&showCountTime=' + showCountTime
'pages/order/detail?id=' + });
item.orderId +
'&type=' +
type +
'&showCountTime=' +
showCountTime,
})
}, },
async initSettleInfo() { async initSettleInfo() {
let self = this let self = this;
// 加载消息列表 // 加载消息列表
this.loadMessageList() this.loadMessageList();
if (this.vuex_token) { if (this.vuex_token) {
const callBack = (vm, result) => { const callBack = (vm, result) => {
// 后台自动判断入驻流程是否完成,前台通过status确定状态 // 后台自动判断入驻流程是否完成,前台通过status确定状态
if (result && result.record) { if (result && result.record) {
// 不返回该字段或返回true代表需要入驻 // 不返回该字段或返回true代表需要入驻
vm.needSettled = result.needSettled == undefined ? true : result.needSettled vm.needSettled = result.needSettled == undefined ? true : result.needSettled;
vm.status = Number(result.record.status || '0') vm.status = Number(result.record.status || '0');
// vm.status = 8 // vm.status = 8
} }
} };
self.search.pageNumber = 0 self.search.pageNumber = 0;
self.loadedOrder = false self.loadedOrder = false;
await app.getBaseInfo(self, callBack) await app.getBaseInfo(self, callBack);
if (this.status == 7) { if (this.status == 7) {
this.getLocation() this.getLocation();
self.loadOrderList() self.loadOrderList();
} }
this.loaded = true this.loaded = true;
} else { } else {
this.loaded = true this.loaded = true;
} }
}, },
loadMessageList() { loadMessageList() {
let self = this let self = this;
self.$u.api.listByNotice().then((res) => { self.$u.api.listByNotice().then(res => {
uni.stopPullDownRefresh() // 结束下拉刷新 uni.stopPullDownRefresh(); // 结束下拉刷新
if (res.code == 200) { if (res.code == 200) {
if (res.data && res.data.length > 2) { if (res.data && res.data.length > 2) {
self.messageList = res.data.slice(0, 2) self.messageList = res.data.slice(0, 2);
} else { } else {
self.messageList = res.data || [] self.messageList = res.data || [];
} }
} else { } else {
console.log(res.message, '初始化消息列表异常') console.log(res.message, '初始化消息列表异常');
} }
}) });
}, },
async loadOrderList() { async loadOrderList() {
this.search.pageNumber += 1 this.search.pageNumber += 1;
let self = this let self = this;
// 加载订单列表 // 加载订单列表
self.search.token = self.vuex_token self.search.token = self.vuex_token;
self.$u.api.listByRecommendOrder(self.search).then((res) => { self.$u.api.listByRecommendOrder(self.search).then(res => {
self.loadedOrder = true self.loadedOrder = true;
if (res.code == 200 && res.data) { if (res.code == 200 && res.data) {
if (self.search.pageNumber == 1) { if (self.search.pageNumber == 1) {
self.orderList = [] self.orderList = [];
} }
if (res.data.list) { if (res.data.list) {
// self.orderList.push(...res.data.list) // self.orderList.push(...res.data.list)
// 更新每一条时间戳,防止后台返回的数据和原先一样,不触发ordercell的时间计算 // 更新每一条时间戳,防止后台返回的数据和原先一样,不触发ordercell的时间计算
var time = new Date().getTime() var time = new Date().getTime();
for (var item of res.data.list) { for (var item of res.data.list) {
item.currentCellTime = time item.currentCellTime = time;
self.orderList.push(item) self.orderList.push(item);
} }
} }
self.currentLoadStatus = self.currentLoadStatus = res.data.total > self.orderList.length && (res.data.list || []).length == self.search.pageSize ? 'loadmore' : 'nomore';
res.data.total > self.orderList.length &&
(res.data.list || []).length == self.search.pageSize
? 'loadmore'
: 'nomore'
} else { } else {
console.log(res.message, '初始化订单列表异常') console.log(res.message, '初始化订单列表异常');
} }
self.$nextTick(() => { self.$nextTick(() => {
if (self._freshing) { if (self.freshing) {
self.triggered = false self.triggered = false;
self._freshing = false self.freshing = false;
} }
}) });
}) });
}, },
reachBottom() { reachBottom() {
if (this.vuex_token) { if (this.vuex_token) {
if (this.currentLoadStatus != 'loadmore') return if (this.currentLoadStatus != 'loadmore') return;
this.currentLoadStatus == 'loading' this.currentLoadStatus == 'loading';
this.loadOrderList() this.loadOrderList();
} }
}, },
onRefresh() { onRefresh() {
if (this._freshing) return if (this.freshing) return;
this._freshing = true this.freshing = true;
this.initSettleInfo() this.initSettleInfo();
}, },
onRestore() { onRestore() {
this.triggered = 'restore' // 需要重置 this.triggered = 'restore'; // 需要重置
}, },
scroll(e) { scroll(e) {
this.old.scrollTop = e.detail.scrollTop this.old.scrollTop = e.detail.scrollTop;
}, },
goTop(e) { goTop(e) {
this.scrollTop = this.old.scrollTop this.scrollTop = this.old.scrollTop;
this.$nextTick(function() { this.$nextTick(function() {
this.scrollTop = 0 this.scrollTop = 0;
}) });
}, },
/* 立即入驻 */ /* 立即入驻 */
immediatelyIn() { immediatelyIn() {
if (this.vuex_token) { if (this.vuex_token) {
// 用户已登录 // 用户已登录
var pageIndex = 1 var pageIndex = 1;
// 0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',5=>'已签约',6=>'未支付保证金',7=>'已支付保证金',8=>'已通过考试',9=>'待提交' // 0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',5=>'已签约',6=>'未支付保证金',7=>'已支付保证金',8=>'已通过考试',9=>'待提交'
switch (this.status) { switch (this.status) {
case 1: case 1:
case 2: case 2:
case 3: case 3:
case 4: case 4:
pageIndex = 2 pageIndex = 2;
break break;
case 8: case 8:
pageIndex = 3 pageIndex = 3;
break break;
case 5: case 5:
case 6: case 6:
pageIndex = 4 pageIndex = 4;
break break;
case 7: case 7:
pageIndex = 5 pageIndex = 5;
break break;
default: default:
pageIndex = 1 pageIndex = 1;
break break;
} }
uni.navigateTo({ uni.navigateTo({
url: url: this.status > 0 ? '/pages/settle/prompt?pageIndex=' + pageIndex : '/pages/settle/index'
this.status > 0 });
? '/pages/settle/prompt?pageIndex=' + pageIndex
: '/pages/settle/index',
})
} else { } else {
// 用户未登录 // 用户未登录
uni.navigateTo({ uni.navigateTo({
url: 'pages/login/index', url: 'pages/login/index'
}) });
} }
}, },
// 获取订单数量 // 获取订单数量
getOrderCount() { getOrderCount() {
var self = this // 加载订单列表 var self = this; // 加载订单列表
self.$u.api.listOrderCount().then((res) => { self.$u.api.listOrderCount().then(res => {
if (res.code == 200) { if (res.code == 200) {
if (res.data) { if (res.data) {
var count = 0 var count = 0;
for (var item of this.countKeys) { for (var item of this.countKeys) {
count += res.data[item] || 0 count += res.data[item] || 0;
} }
// 修改tab总数 // 修改tab总数
if (count > 0) { if (count > 0) {
uni.setTabBarBadge({ uni.setTabBarBadge({
index: 1, index: 1,
text: String(count), text: String(count)
}) });
} else { } else {
uni.removeTabBarBadge({ uni.removeTabBarBadge({
index: 1, index: 1
}) });
} }
} }
} else { } else {
console.log(res.message, '获取订单数量失败!') console.log(res.message, '获取订单数量失败!');
} }
}) });
}, },
/** /**
* 获取当前位置的经纬度 * 获取当前位置的经纬度
*/ */
getLocation() { getLocation() {
let self = this let self = this;
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
success: function(res) { success: function(res) {
self.location = [res.latitude, res.longitude] self.location = [res.latitude, res.longitude];
}, },
complete: function(res) { complete: function(res) {
if (res.errMsg.indexOf('auth') != -1) { if (res.errMsg.indexOf('auth') != -1) {
...@@ -434,36 +366,36 @@ export default { ...@@ -434,36 +366,36 @@ export default {
if (res.confirm) { if (res.confirm) {
uni.openSetting({ uni.openSetting({
success(res) { success(res) {
console.log(res.authSetting) console.log(res.authSetting);
},
})
} }
}, });
}) }
}
});
} }
}, },
fail: function(err) {}, fail: function(err) {}
}) });
}, },
toNewsDetail(item) { toNewsDetail(item) {
wx.navigateTo({ wx.navigateTo({
url: '/pages/learn/news-details', url: '/pages/learn/news-details',
success: function(res) { success: function(res) {
res.eventChannel.emit('acceptDataFromLearn', item) res.eventChannel.emit('acceptDataFromLearn', item);
}, }
}) });
}, },
handleClickBanner() { handleClickBanner() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/mine/customer/index' + '?type=exclusive', url: '/pages/mine/customer/index' + '?type=exclusive'
}) });
}, },
// 显示提示蒙版 // 显示提示蒙版
showMaskTip() { showMaskTip() {
this.showMask = true this.showMask = true;
}, }
}, }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<template> <template>
<view class="study"> <view class="study">
<u-navbar :is-back="false" background="{background: transparent}" :border-bottom="false" :is-fixed="false"> <u-navbar :is-back="false" background="{background: transparent}" :border-bottom="false" :is-fixed="false"><text class="title-view">学习</text></u-navbar>
<text class="title-view">学习</text>
</u-navbar>
<image :src="bannerImage" mode="" class="banner"></image> <image :src="bannerImage" mode="" class="banner"></image>
<u-tabs-swiper bg-color="#F4F5F7" inactive-color="#999999" font-size="28" ref="uTabs" :list="tabs" :current="current" @change="tabsChange" :is-scroll="false" :bar-width="52" swiperWidth="750"></u-tabs-swiper> <u-tabs-swiper
bg-color="#F4F5F7"
inactive-color="#999999"
font-size="28"
ref="uTabs"
:list="tabs"
:current="current"
@change="tabsChange"
:is-scroll="false"
:bar-width="52"
swiperWidth="750"
></u-tabs-swiper>
<swiper class="swiper_group" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"> <swiper class="swiper_group" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
<swiper-item @touchmove.stop.prevent="stopTouchMove"> <swiper-item @touchmove.stop.prevent="stopTouchMove">
<scroll-view scroll-y style="width:100%;"> <scroll-view scroll-y style="width:100%;">
...@@ -33,20 +42,30 @@ ...@@ -33,20 +42,30 @@
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
<swiper-item @touchmove.stop.prevent="stopTouchMove"> <swiper-item @touchmove.stop.prevent="stopTouchMove">
<scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onreachBottom" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" @refresherpulling="onPulling" @refresherrefresh="onRefresh" @refresherrestore="onRestore" @refresherabort="onAbort"> <scroll-view
scroll-y
style="height:100%;width:100%;"
@scrolltolower="onreachBottom"
scroll-y="true"
refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-threshold="100"
@refresherpulling="onPulling"
@refresherrefresh="onRefresh"
@refresherrestore="onRestore"
@refresherabort="onAbort"
>
<view v-for="item in list" :key="item.id" class="notice" @click="bbb(item)"> <view v-for="item in list" :key="item.id" class="notice" @click="bbb(item)">
<view class="notice-bottom-left">{{item.create_at}}</view> <view class="notice-bottom-left">{{ item.create_at }}</view>
<view class="notice-content"> <view class="notice-content">
<img :src="item.img" alt="" style="width:690rpx;height:260rpx;display:block"> <img :src="item.img" alt="" style="width:690rpx;height:260rpx;display:block" />
<view class="notice-content-bottom"> <view class="notice-content-bottom">
<view class="n-head">{{item.title}}</view> <view class="n-head">{{ item.title }}</view>
<view class="news">{{item.text}}</view> <view class="news">{{ item.text }}</view>
</view> </view>
</view> </view>
</view> </view>
<view v-shou="isLoadMore" class="load-more"> <view v-shou="isLoadMore" class="load-more"><u-loadmore :status="loadStatus" /></view>
<u-loadmore :status="loadStatus" />
</view>
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
<swiper-item @touchmove.stop.prevent="stopTouchMove" v-if="version"> <swiper-item @touchmove.stop.prevent="stopTouchMove" v-if="version">
...@@ -57,34 +76,24 @@ ...@@ -57,34 +76,24 @@
<image class="learn-img" :src="courselist[0].pic" mode=""></image> <image class="learn-img" :src="courselist[0].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image> <image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc"> <view class="learn-desc">
<view class="u-font-28 font-bold h68"> <view class="u-font-28 font-bold h68">{{ courselist[0].title }}</view>
{{ courselist[0].title }} <view class="u-font-20 learn-intro h48">{{ courselist[0].desc }}</view>
</view>
<view class="u-font-20 learn-intro h48">
{{ courselist[0].desc }}
</view>
</view> </view>
<view class="line-percent u-margin-top-35"> <view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[0].percent" :show-percent="false"> <u-line-progress active-color="#2979ff" :percent="courselist[0].percent" :show-percent="false"></u-line-progress>
</u-line-progress> <text class="font-default-color" :class="{ 'font-active-color': courselist[0].percent }" v-text="courselist[0].status"></text>
<text class="font-default-color" :class="{'font-active-color':courselist[0].percent}" v-text="courselist[0].status"></text>
</view> </view>
</view> </view>
<view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[1])"> <view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[1])">
<image class="learn-img" :src="courselist[1].pic" mode=""></image> <image class="learn-img" :src="courselist[1].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image> <image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc"> <view class="learn-desc">
<view class="u-font-28 font-bold h68"> <view class="u-font-28 font-bold h68">{{ courselist[1].title }}</view>
{{ courselist[1].title }} <view class="u-font-20 learn-intro h48">{{ courselist[1].desc }}</view>
</view>
<view class="u-font-20 learn-intro h48">
{{ courselist[1].desc }}
</view>
</view> </view>
<view class="line-percent u-margin-top-35"> <view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[1].percent" :show-percent="false"> <u-line-progress active-color="#2979ff" :percent="courselist[1].percent" :show-percent="false"></u-line-progress>
</u-line-progress> <text class="font-default-color" :class="{ 'font-active-color': courselist[1].percent }" v-text="courselist[1].status"></text>
<text class="font-default-color" :class="{'font-active-color':courselist[1].percent}" v-text="courselist[1].status"></text>
</view> </view>
</view> </view>
</view> </view>
...@@ -93,34 +102,24 @@ ...@@ -93,34 +102,24 @@
<image class="learn-img" :src="courselist[2].pic" mode=""></image> <image class="learn-img" :src="courselist[2].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image> <image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc"> <view class="learn-desc">
<view class="u-font-28 font-bold h68"> <view class="u-font-28 font-bold h68">{{ courselist[2].title }}</view>
{{ courselist[2].title }} <view class="u-font-20 learn-intro h48">{{ courselist[2].desc }}</view>
</view>
<view class="u-font-20 learn-intro h48">
{{ courselist[2].desc }}
</view>
</view> </view>
<view class="line-percent u-margin-top-35" style="display:flex;justify-content: space-between;"> <view class="line-percent u-margin-top-35" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" :percent="courselist[2].percent" :show-percent="false"> <u-line-progress active-color="#2979ff" :percent="courselist[2].percent" :show-percent="false"></u-line-progress>
</u-line-progress> <text class="font-default-color" :class="{ 'font-active-color': courselist[2].percent }" v-text="courselist[2].status"></text>
<text class="font-default-color" :class="{'font-active-color':courselist[2].percent}" v-text="courselist[2].status"></text>
</view> </view>
</view> </view>
<view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[3])"> <view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[3])">
<image class="learn-img" :src="courselist[3].pic" mode=""></image> <image class="learn-img" :src="courselist[3].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image> <image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc"> <view class="learn-desc">
<view class="u-font-28 font-bold h68"> <view class="u-font-28 font-bold h68">{{ courselist[3].title }}</view>
{{ courselist[3].title }} <view class="u-font-20 learn-intro h48">{{ courselist[3].desc }}</view>
</view>
<view class="u-font-20 learn-intro h48">
{{ courselist[3].desc }}
</view>
</view> </view>
<view class="line-percent u-margin-top-35"> <view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[3].percent" :show-percent="false"> <u-line-progress active-color="#2979ff" :percent="courselist[3].percent" :show-percent="false"></u-line-progress>
</u-line-progress> <text class="font-default-color" :class="{ 'font-active-color': courselist[3].percent }" v-text="courselist[3].status"></text>
<text class="font-default-color" :class="{'font-active-color':courselist[3].percent}" v-text="courselist[3].status"></text>
</view> </view>
</view> </view>
</view> </view>
...@@ -133,33 +132,22 @@ ...@@ -133,33 +132,22 @@
<view class="class1" @click="aaa(0)"> <view class="class1" @click="aaa(0)">
<image class="img" :src="examList[0].pic" mode=""></image> <image class="img" :src="examList[0].pic" mode=""></image>
<view class="right"> <view class="right">
<view class="u-font-32 font-bold"> <view class="u-font-32 font-bold">{{ examList[0].title }}</view>
{{ examList[0].title }} <view class="u-font-24">{{ examList[0].desc }}</view>
</view>
<view class="u-font-24">
{{ examList[0].desc }}
</view>
<view class="u-font-24" style="display:flex;justify-content: space-between;"> <view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[0].condition }}</text> <text class="font-color-999999">{{ examList[0].condition }}</text>
<text class="font-default-exam-color" :class="{'font-active-color':examList[0].isComplete}"> <text class="font-default-exam-color" :class="{ 'font-active-color': examList[0].isComplete }">{{ examList[0].status }}</text>
{{ examList[0].status }}
</text>
</view> </view>
</view> </view>
</view> </view>
<view class="class1 u-margin-top-40" @click="aaa(1)"> <view class="class1 u-margin-top-40" @click="aaa(1)">
<image class="img" :src="examList[1].pic" mode=""></image> <image class="img" :src="examList[1].pic" mode=""></image>
<view class="right"> <view class="right">
<view class="u-font-32 font-bold"> <view class="u-font-32 font-bold">{{ examList[1].title }}</view>
{{examList[1].title}} <view class="u-font-24">{{ examList[1].desc }}</view>
</view>
<view class="u-font-24">
{{ examList[1].desc }}
</view>
<view class="u-font-24" style="display:flex;justify-content: space-between;"> <view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[1].condition }}</text> <text class="font-color-999999">{{ examList[1].condition }}</text>
<text class="font-default-exam-color" :class="{'font-active-color':examList[1].isComplete}"> <text class="font-default-exam-color" :class="{ 'font-active-color': examList[1].isComplete }">{{ examList[1].status }}</text>
{{ examList[1].status }}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -174,199 +162,199 @@ ...@@ -174,199 +162,199 @@
var json = { var json = {
dev: [ dev: [
{ {
title: "安装材料及工具准备", title: '安装材料及工具准备',
desc: "前期的安装材料及安装工具的准备是工作的良好开始", desc: '前期的安装材料及安装工具的准备是工作的良好开始',
pic: process.uniEnv.qn_base_url + "fwgf-3x-v2.png", pic: process.uniEnv.qn_base_url + 'fwgf-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 173, id: 173,
sectionId: "", sectionId: ''
}, },
{ {
title: "服务理念与时效", title: '服务理念与时效',
desc: "为用户提供更好的服务,自己赚更多的钱", desc: '为用户提供更好的服务,自己赚更多的钱',
pic: process.uniEnv.qn_base_url + "jdgf-3x-v2.png", pic: process.uniEnv.qn_base_url + 'jdgf-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 173, id: 173,
sectionId: "", sectionId: ''
}, },
{ {
title: "充电桩安装要点提示", title: '充电桩安装要点提示',
desc: "在充电装安装过程中需要着重注意的要点", desc: '在充电装安装过程中需要着重注意的要点',
pic: process.uniEnv.qn_base_url + "cdz-3x-v2.png", pic: process.uniEnv.qn_base_url + 'cdz-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 173, id: 173,
sectionId: "", sectionId: ''
}, },
{ {
title: "充电桩安装要点提示", title: '充电桩安装要点提示',
desc: "在充电装安装过程中需要着重注意的要点", desc: '在充电装安装过程中需要着重注意的要点',
pic: process.uniEnv.qn_base_url + "cdz-3x-v2.png", pic: process.uniEnv.qn_base_url + 'cdz-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 173, id: 173,
sectionId: "", sectionId: ''
}, }
], ],
test: [ test: [
{ {
title: "安装材料及工具准备", title: '安装材料及工具准备',
desc: "前期的安装材料及安装工具的准备是工作的良好开始", desc: '前期的安装材料及安装工具的准备是工作的良好开始',
pic: process.uniEnv.qn_base_url + "fwgf-3x-v2.png", pic: process.uniEnv.qn_base_url + 'fwgf-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 150, id: 150,
sectionId: "", sectionId: ''
}, },
{ {
title: "服务理念与时效", title: '服务理念与时效',
desc: "为用户提供更好的服务,自己赚更多的钱", desc: '为用户提供更好的服务,自己赚更多的钱',
pic: process.uniEnv.qn_base_url + "jdgf-3x-v2.png", pic: process.uniEnv.qn_base_url + 'jdgf-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 149, id: 149,
sectionId: "", sectionId: ''
}, },
{ {
title: "充电桩安装要点提示", title: '充电桩安装要点提示',
desc: "在充电装安装过程中需要着重注意的要点", desc: '在充电装安装过程中需要着重注意的要点',
pic: process.uniEnv.qn_base_url + "cdz-3x-v2.png", pic: process.uniEnv.qn_base_url + 'cdz-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 151, id: 151,
sectionId: "", sectionId: ''
}, },
{ {
title: "小程序使用指南", title: '小程序使用指南',
desc: "小程序使用指南", desc: '小程序使用指南',
pic: process.uniEnv.qn_base_url + "cdz-3x-v2.png", pic: process.uniEnv.qn_base_url + 'cdz-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 152, id: 152,
sectionId: "", sectionId: ''
}, }
], ],
prod: [ prod: [
{ {
title: "安装材料及工具准备", title: '安装材料及工具准备',
desc: "前期的安装材料及安装工具的准备是工作的良好开始", desc: '前期的安装材料及安装工具的准备是工作的良好开始',
pic: process.uniEnv.qn_base_url + "fwgf-3x-v2.png", pic: process.uniEnv.qn_base_url + 'fwgf-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 597, id: 597,
sectionId: "", sectionId: ''
}, },
{ {
title: "服务理念与时效", title: '服务理念与时效',
desc: "为用户提供更好的服务,自己赚更多的钱", desc: '为用户提供更好的服务,自己赚更多的钱',
pic: process.uniEnv.qn_base_url + "jdgf-3x-v2.png", pic: process.uniEnv.qn_base_url + 'jdgf-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 598, id: 598,
sectionId: "", sectionId: ''
}, },
{ {
title: "充电桩安装要点提示", title: '充电桩安装要点提示',
desc: "在充电装安装过程中需要着重注意的要点", desc: '在充电装安装过程中需要着重注意的要点',
pic: process.uniEnv.qn_base_url + "cdz-3x-v2.png", pic: process.uniEnv.qn_base_url + 'cdz-3x-v2.png',
percent: 0, percent: 0,
status: "", status: '',
id: 599, id: 599,
sectionId: "", sectionId: ''
}, },
{ {
title: "小程序使用指南", title: '小程序使用指南',
desc: "小程序使用指南", desc: '小程序使用指南',
pic: process.uniEnv.qn_base_url + "yaodiantishi.png", pic: process.uniEnv.qn_base_url + 'yaodiantishi.png',
percent: 0, percent: 0,
status: "", status: '',
id: 600, id: 600,
sectionId: "", sectionId: ''
}, }
], ]
}; };
var examJson = { var examJson = {
dev: [ dev: [
{ {
title: "安装材料及工具准备", title: '安装材料及工具准备',
desc: "通过本认证,是接单的必要条件", desc: '通过本认证,是接单的必要条件',
condition: "随机20题,及格20题", condition: '随机20题,及格20题',
status: "", status: '',
pic: process.uniEnv.qn_base_url + "fuwuguifan-d.png", pic: process.uniEnv.qn_base_url + 'fuwuguifan-d.png',
id: 2, id: 2,
examId: "", examId: '',
examStatus: "", examStatus: '',
isComplete: false, isComplete: false,
questionTime: null, questionTime: null
}, },
{ {
title: "接单操作", title: '接单操作',
desc: "快速认证,是否具备接单操作能力", desc: '快速认证,是否具备接单操作能力',
condition: "随机20题,及格16题", condition: '随机20题,及格16题',
status: "", status: '',
pic: process.uniEnv.qn_base_url + "jiedanguifan-d.png", pic: process.uniEnv.qn_base_url + 'jiedanguifan-d.png',
id: 2, id: 2,
examId: "", examId: '',
examStatus: "", examStatus: '',
isComplete: false, isComplete: false,
questionTime: null, questionTime: null
}, }
], ],
test: [ test: [
{ {
title: "安装材料及工具准备", title: '安装材料及工具准备',
desc: "通过本认证,是接单的必要条件", desc: '通过本认证,是接单的必要条件',
condition: "随机4题,及格4题", condition: '随机4题,及格4题',
status: "", status: '',
pic: process.uniEnv.qn_base_url + "fuwuguifan-d.png", pic: process.uniEnv.qn_base_url + 'fuwuguifan-d.png',
id: 3, id: 3,
examId: "", examId: '',
examStatus: "", examStatus: '',
questionTime: null, questionTime: null,
isComplete: false, isComplete: false
}, },
{ {
title: "接单规范", title: '接单规范',
desc: "快速认证,是否具备接单操作能力", desc: '快速认证,是否具备接单操作能力',
condition: "随机5题,及格5题", condition: '随机5题,及格5题',
status: "", status: '',
pic: process.uniEnv.qn_base_url + "jiedanguifan-d.png", pic: process.uniEnv.qn_base_url + 'jiedanguifan-d.png',
id: 4, id: 4,
examId: "", examId: '',
examStatus: "", examStatus: '',
questionTime: null, questionTime: null,
isComplete: false, isComplete: false
}, }
], ],
prod: [ prod: [
{ {
title: "安装材料及工具准备", title: '安装材料及工具准备',
desc: "通过本认证,是接单的必要条件", desc: '通过本认证,是接单的必要条件',
condition: "随机4题,及格4题", condition: '随机4题,及格4题',
status: "", status: '',
pic: process.uniEnv.qn_base_url + "fuwuguifan-d.png", pic: process.uniEnv.qn_base_url + 'fuwuguifan-d.png',
id: 3, id: 3,
examId: "", examId: '',
examStatus: "", examStatus: '',
isComplete: false, isComplete: false,
questionTime: null, questionTime: null
}, },
{ {
title: "接单规范", title: '接单规范',
desc: "快速认证,是否具备接单操作能力", desc: '快速认证,是否具备接单操作能力',
condition: "随机5题,及格5题", condition: '随机5题,及格5题',
status: "", status: '',
pic: process.uniEnv.qn_base_url + "jiedanguifan-d.png", pic: process.uniEnv.qn_base_url + 'jiedanguifan-d.png',
id: 4, id: 4,
examId: "", examId: '',
examStatus: "", examStatus: '',
isComplete: false, isComplete: false,
questionTime: null, questionTime: null
}, }
], ]
}; };
let env = process.uniEnv.node_env; let env = process.uniEnv.node_env;
let courseListJson = json[env]; let courseListJson = json[env];
...@@ -377,38 +365,38 @@ export default { ...@@ -377,38 +365,38 @@ export default {
return { return {
tabs: [ tabs: [
{ {
name: "交付规范", name: '交付规范'
}, },
{ {
name: "消息通知", name: '消息通知'
}, },
{ {
name: "在线学习", name: '在线学习'
}, },
{ {
name: "考核认证", name: '考核认证'
}, }
], ],
tabs2: [ tabs2: [
{ {
name: "交付规范", name: '交付规范'
}, },
{ {
name: "消息通知", name: '消息通知'
}, },
{ {
name: "考核认证", name: '考核认证'
}, }
], ],
bofang: process.uniEnv.qn_base_url + "bofang@3x.png", bofang: process.uniEnv.qn_base_url + 'bofang@3x.png',
current: 0, current: 0,
swiperCurrent: 0, swiperCurrent: 0,
params: { params: {
start: 0, start: 0
}, },
list: [], list: [],
rule: { rule: {
pic: process.uniEnv.qn_base_url + "guifan-d.png", pic: process.uniEnv.qn_base_url + 'guifan-d.png'
}, },
courselist: [ courselist: [
{ {
...@@ -418,7 +406,7 @@ export default { ...@@ -418,7 +406,7 @@ export default {
status: courseListJson[0].status, status: courseListJson[0].status,
pic: courseListJson[0].pic, pic: courseListJson[0].pic,
id: courseListJson[0].id, id: courseListJson[0].id,
sectionId: courseListJson[0].sectionId, sectionId: courseListJson[0].sectionId
}, },
{ {
title: courseListJson[1].title, title: courseListJson[1].title,
...@@ -427,7 +415,7 @@ export default { ...@@ -427,7 +415,7 @@ export default {
status: courseListJson[1].status, status: courseListJson[1].status,
pic: courseListJson[1].pic, pic: courseListJson[1].pic,
id: courseListJson[1].id, id: courseListJson[1].id,
sectionId: courseListJson[1].sectionId, sectionId: courseListJson[1].sectionId
}, },
{ {
title: courseListJson[2].title, title: courseListJson[2].title,
...@@ -436,7 +424,7 @@ export default { ...@@ -436,7 +424,7 @@ export default {
status: courseListJson[2].status, status: courseListJson[2].status,
pic: courseListJson[2].pic, pic: courseListJson[2].pic,
id: courseListJson[2].id, id: courseListJson[2].id,
sectionId: courseListJson[2].sectionId, sectionId: courseListJson[2].sectionId
}, },
{ {
title: courseListJson[3].title, title: courseListJson[3].title,
...@@ -445,8 +433,8 @@ export default { ...@@ -445,8 +433,8 @@ export default {
status: courseListJson[3].status, status: courseListJson[3].status,
pic: courseListJson[3].pic, pic: courseListJson[3].pic,
id: courseListJson[3].id, id: courseListJson[3].id,
sectionId: courseListJson[3].sectionId, sectionId: courseListJson[3].sectionId
}, }
], ],
examList: [ examList: [
{ {
...@@ -459,7 +447,7 @@ export default { ...@@ -459,7 +447,7 @@ export default {
examId: examListJson[0].examId, examId: examListJson[0].examId,
examStatus: examListJson[0].examStatus, examStatus: examListJson[0].examStatus,
isComplete: examListJson[0].isComplete, isComplete: examListJson[0].isComplete,
questionTime: examListJson[0].questionTime, questionTime: examListJson[0].questionTime
}, },
{ {
title: examListJson[1].title, title: examListJson[1].title,
...@@ -471,21 +459,21 @@ export default { ...@@ -471,21 +459,21 @@ export default {
examId: examListJson[1].examId, examId: examListJson[1].examId,
examStatus: examListJson[1].examStatus, examStatus: examListJson[1].examStatus,
isComplete: examListJson[1].isComplete, isComplete: examListJson[1].isComplete,
questionTime: examListJson[1].questionTime, questionTime: examListJson[1].questionTime
}, }
], ],
loadStatus: "loading", loadStatus: 'loading',
isLoadMore: false, isLoadMore: false,
exam: null, exam: null,
jianBianImg: process.uniEnv.qn_base_url + "jianbian-fp.png", jianBianImg: process.uniEnv.qn_base_url + 'jianbian-fp.png',
isReflesh: true, isReflesh: true,
triggered: false, triggered: false,
_freshing: false, freshing: false,
version: true, version: true
}; };
}, },
onLoad(param) { onLoad(param) {
getApp().trackPage("学习首页"); getApp().trackPage('学习首页');
var that = this; var that = this;
try { try {
if (param.tabs) { if (param.tabs) {
...@@ -497,16 +485,16 @@ export default { ...@@ -497,16 +485,16 @@ export default {
}, },
computed: { computed: {
bannerImage() { bannerImage() {
return process.uniEnv.qn_base_url + "xuexibanner-p.png"; return process.uniEnv.qn_base_url + 'xuexibanner-p.png';
}, },
jianbianImage() { jianbianImage() {
return process.uniEnv.qn_base_url + "jianbian-p.png"; return process.uniEnv.qn_base_url + 'jianbian-p.png';
}, },
anzhuangwenjianImage() { anzhuangwenjianImage() {
return process.uniEnv.qn_base_url + "wenjian-d.png"; return process.uniEnv.qn_base_url + 'wenjian-d.png';
}, }
}, },
onShow: function (param) { onShow: function(param) {
try { try {
if (param.tabs) { if (param.tabs) {
this.current = param.tabs; this.current = param.tabs;
...@@ -523,38 +511,38 @@ export default { ...@@ -523,38 +511,38 @@ export default {
let that = this; let that = this;
this.$u.api this.$u.api
.getVersionInfo(version) .getVersionInfo(version)
.then((res) => { .then(res => {
let data = res.data; let data = res.data;
if (data.hasOwnProperty("is_audit") && data.is_audit == 0) { if (data.hasOwnProperty('is_audit') && data.is_audit == 0) {
that.tabs = that.tabs2; that.tabs = that.tabs2;
that.version = false; that.version = false;
} }
}) })
.catch((err) => {}); .catch(err => {});
}, },
stopPull() { stopPull() {
let that = this; let that = this;
setTimeout(function () { setTimeout(function() {
that.triggered = false; that.triggered = false;
that._freshing = false; that.freshing = false;
}, 1000); }, 1000);
}, },
onPulling(e) { onPulling(e) {
return true; return true;
}, },
onRefresh() { onRefresh() {
if (this._freshing) return; if (this.freshing) return;
this.triggered = true; this.triggered = true;
this._freshing = true; this.freshing = true;
this.isLoadMore = false; this.isLoadMore = false;
this.loadStatus = "loading"; this.loadStatus = 'loading';
this.loadNews(); this.loadNews();
}, },
onRestore() { onRestore() {
this.triggered = "restore"; // 需要重置 this.triggered = 'restore'; // 需要重置
}, },
onAbort() { onAbort() {
console.log("onAbort"); console.log('onAbort');
}, },
transition(e) { transition(e) {
// swiper-item左右移动,通知tabs的滑块跟随移动 // swiper-item左右移动,通知tabs的滑块跟随移动
...@@ -567,7 +555,7 @@ export default { ...@@ -567,7 +555,7 @@ export default {
if (!this.isLoadMore) { if (!this.isLoadMore) {
this.isLoadMore = true; this.isLoadMore = true;
this.params.start += 5; this.params.start += 5;
if (this.loadStatus !== "nomore") { if (this.loadStatus !== 'nomore') {
this.getNoticeList(); this.getNoticeList();
} }
} }
...@@ -577,32 +565,29 @@ export default { ...@@ -577,32 +565,29 @@ export default {
}, },
//取文本第一张图片 //取文本第一张图片
imgUrlFun(str) { imgUrlFun(str) {
var data = ""; var data = '';
str.replace( str.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/, function(match, capture) {
/<img [^>]*src=['"]([^'"]+)[^>]*>/,
function (match, capture) {
data = capture; data = capture;
} });
);
return data; return data;
}, },
//取文本信息 //取文本信息
getText(str) { getText(str) {
return str return str
.replace(/<[^<>]+>/g, "") .replace(/<[^<>]+>/g, '')
.replace(/&nbsp;/gi, "") .replace(/&nbsp;/gi, '')
.replace(/(\n)/g, ""); .replace(/(\n)/g, '');
}, },
getNoticeList() { getNoticeList() {
let that = this; let that = this;
this.$u.api this.$u.api
.getTrainingNoticeList(this.params) .getTrainingNoticeList(this.params)
.then((res) => { .then(res => {
that.stopPull(); that.stopPull();
if (res.code != 200) { if (res.code != 200) {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
icon: "none", icon: 'none'
}); });
that.isLoadMore = false; that.isLoadMore = false;
if (that.params.start > 0) { if (that.params.start > 0) {
...@@ -612,27 +597,24 @@ export default { ...@@ -612,27 +597,24 @@ export default {
if (res.data) { if (res.data) {
let length = res.data.length; let length = res.data.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
res.data[i].create_at = this.timeFormat( res.data[i].create_at = this.timeFormat(res.data[i].create_at, 'yyyy.MM.dd hh:mm');
res.data[i].create_at,
"yyyy.MM.dd hh:mm"
);
res.data[i].img = this.imgUrlFun(res.data[i].body); res.data[i].img = this.imgUrlFun(res.data[i].body);
res.data[i].text = this.getText(res.data[i].body); res.data[i].text = this.getText(res.data[i].body);
} }
that.list = that.list.concat(res.data); that.list = that.list.concat(res.data);
console.log("消息列表", that.list); console.log('消息列表', that.list);
} }
if (res.data.length >= 5) { if (res.data.length >= 5) {
that.isLoadMore = false; that.isLoadMore = false;
} else { } else {
that.isLoadMore = true; that.isLoadMore = true;
that.loadStatus = "nomore"; that.loadStatus = 'nomore';
} }
}) })
.catch((err) => { .catch(err => {
uni.showToast({ uni.showToast({
title: err, title: err,
icon: "none", icon: 'none'
}); });
that.isLoadMore = false; that.isLoadMore = false;
if (that.params.start > 0) { if (that.params.start > 0) {
...@@ -642,34 +624,31 @@ export default { ...@@ -642,34 +624,31 @@ export default {
}, },
timeFormat(time, format, fromMysql = true) { timeFormat(time, format, fromMysql = true) {
let rate = fromMysql ? 1000 : 1; let rate = fromMysql ? 1000 : 1;
let dataFmt = format || "yyyy-MM-dd hh:mm:ss"; // 需要格式化的规则 let dataFmt = format || 'yyyy-MM-dd hh:mm:ss'; // 需要格式化的规则
time = typeof time == "number" ? time : new Date(time * rate); // 处理传入的time time = typeof time == 'number' ? time : new Date(time * rate); // 处理传入的time
let fmt = { let fmt = {
"y+": time.getFullYear(), // 年份 'y+': time.getFullYear(), // 年份
"M+": time.getMonth() + 1, // 月份 'M+': time.getMonth() + 1, // 月份
"d+": time.getDate(), // 日 'd+': time.getDate(), // 日
"h+": time.getHours(), // 小时 'h+': time.getHours(), // 小时
"m+": time.getMinutes(), // 分钟 'm+': time.getMinutes(), // 分钟
"s+": time.getSeconds(), // 秒 's+': time.getSeconds() // 秒
}; };
for (let i in fmt) { for (let i in fmt) {
if (new RegExp("(" + i + ")").test(dataFmt)) { if (new RegExp('(' + i + ')').test(dataFmt)) {
dataFmt = dataFmt.replace( dataFmt = dataFmt.replace(RegExp.$1, fmt[i].toString().length <= 1 ? '0' + fmt[i] : fmt[i]);
RegExp.$1,
fmt[i].toString().length <= 1 ? "0" + fmt[i] : fmt[i]
);
} }
} }
return dataFmt; return dataFmt;
}, },
getTypeName(percent) { getTypeName(percent) {
if (percent == 0) { if (percent == 0) {
return "未开始"; return '未开始';
} else if (percent == "100") { } else if (percent == '100') {
return "已完成"; return '已完成';
} else { } else {
return "继续"; return '继续';
} }
}, },
//在线学习通用课程信息 //在线学习通用课程信息
...@@ -677,32 +656,28 @@ export default { ...@@ -677,32 +656,28 @@ export default {
let courseLength = this.courselist.length; let courseLength = this.courselist.length;
for (let i = 0; i < courseLength; i++) { for (let i = 0; i < courseLength; i++) {
let param = { let param = {
course_id: this.courselist[i].id, course_id: this.courselist[i].id
}; };
this.$u.api this.$u.api
.CourseList(param) .CourseList(param)
.then((res) => { .then(res => {
if (res.code != 200) { if (res.code != 200) {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
icon: "none", icon: 'none'
}); });
} }
if (res.data) { if (res.data) {
res.data.learnedInfo.learnPercent *= 100; res.data.learnedInfo.learnPercent *= 100;
this.courselist[i].status = this.getTypeName( this.courselist[i].status = this.getTypeName(res.data.learnedInfo.learnPercent);
res.data.learnedInfo.learnPercent this.courselist[i].percent = res.data.learnedInfo.learnPercent;
); this.courselist[i].sectionId = res.data.learnedInfo.nextLearnedSectionId;
this.courselist[i].percent =
res.data.learnedInfo.learnPercent;
this.courselist[i].sectionId =
res.data.learnedInfo.nextLearnedSectionId;
} }
}) })
.catch((err) => { .catch(err => {
uni.showToast({ uni.showToast({
title: err, title: err,
icon: "none", icon: 'none'
}); });
}); });
} }
...@@ -736,23 +711,23 @@ export default { ...@@ -736,23 +711,23 @@ export default {
//跳转到拍照小程序首页 //跳转到拍照小程序首页
goToPrint() { goToPrint() {
uni.navigateToMiniProgram({ uni.navigateToMiniProgram({
appId: "wxd1d6eede324b0465", appId: 'wxd1d6eede324b0465',
path: "/pages/photo/index", path: '/pages/photo/index',
success(res) { success(res) {
//打开成功 //打开成功
console.log("success", res); console.log('success', res);
}, },
fail(err) { fail(err) {
console.log("err", err); console.log('err', err);
}, }
}); });
}, },
// 安装文件 // 安装文件
goToDocument() { goToDocument() {
getApp().track("learn_goToDocument", {}) getApp().track('learn_goToDocument', {});
this.$u.route({ this.$u.route({
url: 'pages/order/document', url: 'pages/order/document'
}) });
}, },
//考核认证,通用认证,考试通过or未通过查询接口请求 //考核认证,通用认证,考试通过or未通过查询接口请求
getUserExamInfo() { getUserExamInfo() {
...@@ -765,29 +740,26 @@ export default { ...@@ -765,29 +740,26 @@ export default {
let examId = this.examList[i].id; let examId = this.examList[i].id;
this.$u.api this.$u.api
.getExamResult(examId) .getExamResult(examId)
.then((res) => { .then(res => {
if (res.code != 200) { if (res.code != 200) {
console.log("getUserExamInfo 200 err"); console.log('getUserExamInfo 200 err');
uni.showToast({ uni.showToast({
icon: "none", icon: 'none',
title: "获取考试信息失败", title: '获取考试信息失败'
}); });
} }
this.examList[i].examId = res.data.id; this.examList[i].examId = res.data.id;
this.examList[i].examStatus = res.data.examStatus; //i;// this.examList[i].examStatus = res.data.examStatus; //i;//
this.examList[i].questionTime = res.data.questionTime; this.examList[i].questionTime = res.data.questionTime;
let examResult = res.data.examLevelResult; let examResult = res.data.examLevelResult;
this.examList[i].status = this.examList[i].status = examResult != '' ? examResult : '未通过';
examResult != "" ? examResult : "未通过";
//动态获取条件 //动态获取条件
let ruleDisc = res.data.ruleDisc; let ruleDisc = res.data.ruleDisc;
let targetIndex = ruleDisc.indexOf("("); let targetIndex = ruleDisc.indexOf('(');
if (targetIndex) { if (targetIndex) {
this.examList[i].condition = ruleDisc this.examList[i].condition = ruleDisc.substr(targetIndex + 1).replace(')', '');
.substr(targetIndex + 1)
.replace(")", "");
} }
// examStatus 用户考试状态 0考试中 1考试完成 2未参与 // examStatus 用户考试状态 0考试中 1考试完成 2未参与
...@@ -796,8 +768,7 @@ export default { ...@@ -796,8 +768,7 @@ export default {
return; return;
} }
if (res.data.examStatus == 1) { if (res.data.examStatus == 1) {
that.examList[i].isComplete = that.examList[i].isComplete = this.examList[i].status == '已通过';
this.examList[i].status == "已通过";
that.examScore = res.data.examScore; that.examScore = res.data.examScore;
return; return;
} }
...@@ -805,11 +776,11 @@ export default { ...@@ -805,11 +776,11 @@ export default {
that.userExamId = res.data.id; that.userExamId = res.data.id;
} }
}) })
.catch((err) => { .catch(err => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
icon: "none", icon: 'none',
title: "获取考试信息失败", title: '获取考试信息失败'
}); });
}); });
} }
...@@ -818,25 +789,20 @@ export default { ...@@ -818,25 +789,20 @@ export default {
aaa(index) { aaa(index) {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与 //examStatus 用户考试状态 0考试中 1考试完成 2未参与
//考试完成分成通过、未通过 //考试完成分成通过、未通过
getApp().globalData.questionTime = getApp().globalData.questionTime = this.examList[index].questionTime;
this.examList[index].questionTime;
var examInfo = this.examList[index]; var examInfo = this.examList[index];
wx.navigateTo({ wx.navigateTo({
url: "/pages/learn/assessment?examId=" + examInfo.id, url: '/pages/learn/assessment?examId=' + examInfo.id
}); });
}, },
//跳转到播放 //跳转到播放
goPlay(info) { goPlay(info) {
getApp().track("learn_allPlayCounts", {courseId: info.id}) getApp().track('learn_allPlayCounts', { courseId: info.id });
if(info.title === "小程序使用指南") { if (info.title === '小程序使用指南') {
getApp().track("learn_guidePlayCounts", {courseId: info.id}) getApp().track('learn_guidePlayCounts', { courseId: info.id });
} }
uni.navigateTo({ uni.navigateTo({
url: url: '/pages/learn/section?section_id=' + info.sectionId + '&course_id=' + info.id
"/pages/learn/section?section_id=" +
info.sectionId +
"&course_id=" +
info.id,
}); });
}, },
//跳转到消息详情页 //跳转到消息详情页
...@@ -844,18 +810,18 @@ export default { ...@@ -844,18 +810,18 @@ export default {
var news = { var news = {
body: e.body, body: e.body,
title: e.title, title: e.title,
create_at: e.create_at, create_at: e.create_at
}; };
getApp().track("learn_goToMessage", {}) getApp().track('learn_goToMessage', {});
let that = this; let that = this;
wx.navigateTo({ wx.navigateTo({
url: "/pages/learn/news-details", url: '/pages/learn/news-details',
success: function (res) { success: function(res) {
res.eventChannel.emit("acceptDataFromLearn", news); res.eventChannel.emit('acceptDataFromLearn', news);
}, }
}); });
}, }
}, }
}; };
</script> </script>
<style> <style>
...@@ -1061,7 +1027,7 @@ swiper { ...@@ -1061,7 +1027,7 @@ swiper {
} }
.red-color { .red-color {
color: #FA5A49; color: #fa5a49;
} }
.u-progress { .u-progress {
......
...@@ -265,9 +265,6 @@ export default { ...@@ -265,9 +265,6 @@ export default {
app.getBaseInfo(self); app.getBaseInfo(self);
}, },
handleClick(path, isWarehouse) { handleClick(path, isWarehouse) {
this.$u.route({
url: 'pages/mine/' + path
});
if (this.vuex_token) { if (this.vuex_token) {
// 没入驻不能进入仓配相关页面 // 没入驻不能进入仓配相关页面
if (isWarehouse && this.needSettled) { if (isWarehouse && this.needSettled) {
...@@ -284,7 +281,6 @@ export default { ...@@ -284,7 +281,6 @@ export default {
} else { } else {
this.$u.route({ url: 'pages/login/index' }); this.$u.route({ url: 'pages/login/index' });
} }
}, },
handleClickSetting() { handleClickSetting() {
this.$u.route({ url: 'pages/mine/setting/index' }); this.$u.route({ url: 'pages/mine/setting/index' });
...@@ -449,7 +445,7 @@ export default { ...@@ -449,7 +445,7 @@ export default {
} }
.ware-house-title-received { .ware-house-title-received {
font-size: 24rpx; font-size: 24rpx;
color: #409eff; color: #2272ff;
} }
} }
.ware-house-content { .ware-house-content {
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
@change="sectionChange" @change="sectionChange"
height="72" height="72"
bold bold
> ></u-subsection>
</u-subsection>
</view> </view>
<view class="search-btn" @click="handleClickSearch"> <view class="search-btn" @click="handleClickSearch">
<image class="search-image" mode="widthFix" :src="sousuoImage"></image> <image class="search-image" mode="widthFix" :src="sousuoImage"></image>
...@@ -60,54 +59,28 @@ ...@@ -60,54 +59,28 @@
@scroll="scroll" @scroll="scroll"
enable-back-to-top enable-back-to-top
> >
<NoOrder <NoOrder v-if="noMore" imageName="zwdd.png" :customStyle="noOrderCustomStyle" />
v-if="noMore"
imageName="zwdd.png"
:customStyle="noOrderCustomStyle"
/>
<template v-else> <template v-else>
<view <view v-for="item in orderList[curNow][current[curNow]]" :key="item.orderId">
v-for="item in orderList[curNow][current[curNow]]" <OrderCell :orderData="item" :type="cellType" :location="dataValue" @click="handleClick" @action="handleClickCellButton"></OrderCell>
:key="item.orderId"
>
<OrderCell
:orderData="item"
:type="cellType"
:location="dataValue"
@click="handleClick"
@action="handleClickCellButton"
>
</OrderCell>
</view>
<view
class="load-more-view"
v-show="(pageNumber == 1 && loaded) || pageNumber > 1"
>
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</view> </view>
<view class="load-more-view" v-show="(pageNumber == 1 && loaded) || pageNumber > 1"><u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore></view>
</template> </template>
<view class="loading-view" v-if="!loaded && !_freshing"> <view class="loading-view" v-if="!loaded && !freshing"><u-loading mode="flower"></u-loading></view>
<u-loading mode="flower"></u-loading>
</view>
</scroll-view> </scroll-view>
</view> </view>
<!-- 悬浮按钮 --> <!-- 悬浮按钮 -->
<!-- <EusingList type="collapse" /> --> <!-- <EusingList type="collapse" /> -->
<MaskTip <MaskTip :show="showMask" imageName="mengceng1.png" :imageStyle="imageStyle" name="today_tip" />
:show="showMask"
imageName="mengceng1.png"
:imageStyle="imageStyle"
name="today_tip"
/>
</TabBarPage> </TabBarPage>
</template> </template>
<script> <script>
import TabBarPage from '@/components/tabBarList/index.vue' import TabBarPage from '@/components/tabBarList/index.vue';
import OrderCell from '@/components/order/index.vue' import OrderCell from '@/components/order/index.vue';
import NoOrder from '@/components/order/noOrder.vue' import NoOrder from '@/components/order/noOrder.vue';
import upload from '@/components/upload/task.js' import upload from '@/components/upload/task.js';
import MaskTip from '@/components/mask-tip/index.vue' import MaskTip from '@/components/mask-tip/index.vue';
// import EusingList from '@/components/order/eusingList.vue' // import EusingList from '@/components/order/eusingList.vue'
...@@ -116,7 +89,7 @@ export default { ...@@ -116,7 +89,7 @@ export default {
TabBarPage, TabBarPage,
OrderCell, OrderCell,
NoOrder, NoOrder,
MaskTip, MaskTip
// EusingList, // EusingList,
}, },
data() { data() {
...@@ -126,95 +99,89 @@ export default { ...@@ -126,95 +99,89 @@ export default {
orderList: [ orderList: [
// 用多个数组存储可以优化用户切换体验,但是会增加内存 // 用多个数组存储可以优化用户切换体验,但是会增加内存
[[], [], [], [], [], []], [[], [], [], [], [], []],
[[], [], []], [[], [], []]
], ],
list: [ list: [
[ [
{ {
name: '待预约', name: '待预约',
total: 0, total: 0
}, },
{ {
name: '待签到', name: '待签到',
total: 0, total: 0
}, },
{ {
name: '待完工', name: '待完工',
total: 0, total: 0
}, },
{ {
name: '审核中', name: '审核中',
total: 0, total: 0
}, },
{ {
name: '异常单', name: '异常单',
total: 0, total: 0
}, },
{ {
name: '已完工', name: '已完工',
total: 0, total: 0
}, }
], ],
[ [
{ {
name: '待联系', name: '待联系',
total: 0, total: 0
}, },
{ {
name: '待完工', name: '待完工',
total: 0, total: 0
}, },
{ {
name: '异常单', name: '异常单',
total: 0, total: 0
}, }
], ]
], ],
current: { 0: 0, 1: 0 }, current: { 0: 0, 1: 0 },
loadStatus: 'loading', loadStatus: 'loading',
dataValue: [], dataValue: [],
loaded: false, loaded: false,
triggered: true, triggered: true,
_freshing: false, freshing: false,
scrollTop: 0, scrollTop: 0,
old: { old: {
scrollTop: 0, scrollTop: 0
}, },
showMask: false, showMask: false
} };
}, },
computed: { computed: {
subList() { subList() {
return ['全部订单', '今日订单'] return ['全部订单', '今日订单'];
}, },
// 0 全部订单: 0:'待预约', 1:'待签到', 2:'待完工', 3:'审核中', 4:'异常单', 5'已完工' // 0 全部订单: 0:'待预约', 1:'待签到', 2:'待完工', 3:'审核中', 4:'异常单', 5'已完工'
// 1 今日订单: 0:'今日待联系', 1:'今日待完工', 2:'今日异常单' // 1 今日订单: 0:'今日待联系', 1:'今日待完工', 2:'今日异常单'
orderType() { orderType() {
return this.indexStatus[this.curNow][this.current[this.curNow]] return this.indexStatus[this.curNow][this.current[this.curNow]];
}, },
pageSize() { pageSize() {
// 待预约, 待签到,待完工,因为需要排序,所以暂时去掉分页,一次要完所有 // 待预约, 待签到,待完工,因为需要排序,所以暂时去掉分页,一次要完所有
return this.pageSizes[this.curNow][this.current[this.curNow]] return this.pageSizes[this.curNow][this.current[this.curNow]];
}, },
needSort() { needSort() {
// 待预约, 待签到,待完工需要排序 // 待预约, 待签到,待完工需要排序
return this.curNow + this.current[this.curNow] < 3 return this.curNow + this.current[this.curNow] < 3;
}, },
pageSizes() { pageSizes() {
// 待预约, 待签到,待完工,因为需要排序,所以暂时去掉分页,一次要完所有 // 待预约, 待签到,待完工,因为需要排序,所以暂时去掉分页,一次要完所有
return [ return [[10000, 10000, 10000, 15, 15, 15], [10000, 10000, 15]];
[10000, 10000, 10000, 15, 15, 15],
[10000, 10000, 15],
]
}, },
offset() { offset() {
return [ return [[0, 0], [0, 44]];
[0, 0],
[0, 44],
]
}, },
sousuoImage() { sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png' return process.uniEnv.qn_base_url + 'sousuo.png';
}, },
// 每一种状态对应的tab的index // 每一种状态对应的tab的index
types() { types() {
...@@ -225,28 +192,18 @@ export default { ...@@ -225,28 +192,18 @@ export default {
waitFinish: 2, // 待完工、 waitFinish: 2, // 待完工、
audit: 3, // 审核中、 audit: 3, // 审核中、
exception: 4, // 异常单、 exception: 4, // 异常单、
finish: 5, //已完工 finish: 5 //已完工
}, },
{ {
todayWaitContact: 0, // 今日待联系、 todayWaitContact: 0, // 今日待联系、
todayWaitFinish: 1, // 今日待完工、 todayWaitFinish: 1, // 今日待完工、
todayException: 2, // 今日异常单、 todayException: 2 // 今日异常单、
}, }
] ];
}, },
// 每一个tab对应的状态 // 每一个tab对应的状态
indexStatus() { indexStatus() {
return [ return [['waitAppointment', 'waitCheckIn', 'waitFinish', 'audit', 'exception', 'finish'], ['todayWaitContact', 'todayWaitFinish', 'todayException']];
[
'waitAppointment',
'waitCheckIn',
'waitFinish',
'audit',
'exception',
'finish',
],
['todayWaitContact', 'todayWaitFinish', 'todayException'],
]
}, },
// 订单数量接的返回数量的key // 订单数量接的返回数量的key
countKeys() { countKeys() {
...@@ -257,180 +214,151 @@ export default { ...@@ -257,180 +214,151 @@ export default {
'toFinishCount', 'toFinishCount',
'reviewingCount', 'reviewingCount',
'exceptionCount', 'exceptionCount',
'', // 待完工没有数量 '' // 待完工没有数量
], ],
['todayContactCount', 'todayFinishCount', 'todayExceptionCount'], ['todayContactCount', 'todayFinishCount', 'todayExceptionCount']
] ];
}, },
isFinish() { isFinish() {
return this.orderType == 'finish' return this.orderType == 'finish';
}, },
noMore() { noMore() {
return ( return this.orderList[this.curNow][this.current[this.curNow]].length == 0 && this.loaded;
this.orderList[this.curNow][this.current[this.curNow]].length == 0 &&
this.loaded
)
}, },
cellTypes() { cellTypes() {
return [ return [['waitAppointment', 'waitCheckIn', 'waitFinish', 'audit', 'exception', 'finish'], ['', 'waitFinish', 'exception']];
[
'waitAppointment',
'waitCheckIn',
'waitFinish',
'audit',
'exception',
'finish',
],
['', 'waitFinish', 'exception'],
]
}, },
// 仅用于传给OrderCell的type // 仅用于传给OrderCell的type
cellType() { cellType() {
return this.cellTypes[this.curNow][this.current[this.curNow]] return this.cellTypes[this.curNow][this.current[this.curNow]];
}, },
noOrderCustomStyle() { noOrderCustomStyle() {
return 'margin-top: 100rpx;background-color: #F4F5F7' return 'margin-top: 100rpx;background-color: #F4F5F7';
}, },
imageStyle() { imageStyle() {
return 'width:546rpx; margin-top:80rpx; margin-left:100rpx' return 'width:546rpx; margin-top:80rpx; margin-left:100rpx';
} }
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('订单首页') getApp().trackPage('订单首页');
this._freshing = false this.freshing = false;
// 跳转到本页是否带了跳到那个tab的参数 // 跳转到本页是否带了跳到那个tab的参数
if (e && e.type) { if (e && e.type) {
this.current[this.curNow] = Math.max( this.current[this.curNow] = Math.max(0, this.indexStatus[this.curNow].indexOf(e.type));
0,
this.indexStatus[this.curNow].indexOf(e.type)
)
} }
}, },
onShow() { onShow() {
if (this.uploadTask.length > 0) { if (this.uploadTask.length > 0) {
upload.uploadImageTask(this) upload.uploadImageTask(this);
} }
this.reloadOrderInfo() this.reloadOrderInfo();
}, },
methods: { methods: {
sectionChange(index) { sectionChange(index) {
this.curNow = index this.curNow = index;
this.reloadOrderList() this.reloadOrderList();
}, },
// tab栏切换 // tab栏切换
change(index) { change(index) {
this.current[this.curNow] = index this.current[this.curNow] = index;
this.reloadOrderList() this.reloadOrderList();
}, },
// 滚动底部 // 滚动底部
reachBottom(e) { reachBottom(e) {
if (this.loadStatus != 'loadmore') return if (this.loadStatus != 'loadmore') return;
this.loadStatus == 'loading' this.loadStatus == 'loading';
this.getOrderList() this.getOrderList();
}, },
// 页面数据 // 页面数据
getOrderList() { getOrderList() {
// 状态处理 // 状态处理
this.pageNumber += 1 this.pageNumber += 1;
if (this.pageNumber == 1) { if (this.pageNumber == 1) {
this.loaded = false this.loaded = false;
} }
var param = { var param = {
pageNumber: this.pageNumber, pageNumber: this.pageNumber,
pageSize: this.pageSize, pageSize: this.pageSize,
keyword: '', keyword: '',
type: this.orderType, type: this.orderType
} };
var self = this var self = this;
self.$u.api.listOrder(param).then((res) => { self.$u.api.listOrder(param).then(res => {
if (res.code == 200) { if (res.code == 200) {
if (res.data.type != self.orderType) return // 已切换到其他tab,则不处理后台返回的数据 if (res.data.type != self.orderType) return; // 已切换到其他tab,则不处理后台返回的数据
if (self.pageNumber == 1) { if (self.pageNumber == 1) {
// 下拉刷新或切换到新tab,清空对应数组 // 下拉刷新或切换到新tab,清空对应数组
self.orderList[this.curNow][this.current[this.curNow]] = [] self.orderList[this.curNow][this.current[this.curNow]] = [];
} }
if (res.data.list) { if (res.data.list) {
self.orderList[this.curNow][this.current[this.curNow]].push( self.orderList[this.curNow][this.current[this.curNow]].push(...res.data.list);
...res.data.list
)
// 更新tab数字 // 更新tab数字
if ( if (!this.isFinish && self.list[this.curNow][self.types[this.curNow][res.data.type]]) {
!this.isFinish && self.list[this.curNow][self.types[this.curNow][res.data.type]].total = res.data.total;
self.list[this.curNow][self.types[this.curNow][res.data.type]]
) {
self.list[this.curNow][
self.types[this.curNow][res.data.type]
].total = res.data.total
} }
// 待预约, 待签到,待完工需要排序 // 待预约, 待签到,待完工需要排序
if (this.needSort) { if (this.needSort) {
self.orderList[this.curNow][this.current[this.curNow]].sort( self.orderList[this.curNow][this.current[this.curNow]].sort((x, y) => {
(x, y) => { return x.currentOverTime < y.currentOverTime ? 1 : -1;
return x.currentOverTime < y.currentOverTime ? 1 : -1 });
}
)
} }
// 更新底部加载状态 // 更新底部加载状态
self.loadStatus = self.loadStatus =
res.data.total > res.data.total > self.orderList[this.curNow][this.current[this.curNow]].length && res.data.list.length == self.pageSize ? 'loadmore' : 'nomore';
self.orderList[this.curNow][this.current[this.curNow]].length &&
res.data.list.length == self.pageSize
? 'loadmore'
: 'nomore'
} }
} else { } else {
console.log(res.message, '获取订单数量失败!') console.log(res.message, '获取订单数量失败!');
} }
self.$nextTick(() => { self.$nextTick(() => {
if (self._freshing) { if (self.freshing) {
self.triggered = false self.triggered = false;
self._freshing = false self.freshing = false;
} }
}) });
this.loaded = true this.loaded = true;
}) });
}, },
// 获取订单数量 // 获取订单数量
getOrderCount() { getOrderCount() {
this.$u.api.listOrderCount().then((res) => { this.$u.api.listOrderCount().then(res => {
if (res.code == 200) { if (res.code == 200) {
if (res.data) { if (res.data) {
// 修改各个tab数量 // 修改各个tab数量
var j = 0 var j = 0;
var count = 0 var count = 0;
for (var items of this.list) { for (var items of this.list) {
var i = 0 var i = 0;
for (var item of items) { for (var item of items) {
item.total = res.data[this.countKeys[j][i]] || 0 item.total = res.data[this.countKeys[j][i]] || 0;
if (j == 0) { if (j == 0) {
// 非今日订单数量加起来 // 非今日订单数量加起来
count += item.total count += item.total;
} }
i++ i++;
} }
j++ j++;
} }
// 修改tab总数 // 修改tab总数
if (count > 0) { if (count > 0) {
uni.setTabBarBadge({ uni.setTabBarBadge({
index: 1, index: 1,
text: String(count), text: String(count)
}) });
} else { } else {
uni.removeTabBarBadge({ uni.removeTabBarBadge({
index: 1, index: 1
}) });
} }
} }
} else { } else {
console.log(res.message, '获取订单数量失败!') console.log(res.message, '获取订单数量失败!');
} }
}) });
}, },
handleClickCellButton(item) { handleClickCellButton(item) {
if (!this.loaded) return if (!this.loaded) return;
uni.navigateTo({ uni.navigateTo({
url: url:
'pages/order/complete?orderId=' + 'pages/order/complete?orderId=' +
...@@ -452,61 +380,55 @@ export default { ...@@ -452,61 +380,55 @@ export default {
'&auditResults=' + '&auditResults=' +
(item.auditResults ? item.auditResults.join() : '') + (item.auditResults ? item.auditResults.join() : '') +
'&orderNumber=' + '&orderNumber=' +
item.orderNumber, item.orderNumber
}) });
}, },
handleClick(item, type, showCountTime) { handleClick(item, type, showCountTime) {
if (!this.loaded) return if (!this.loaded) return;
// type:类型,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动 // type:类型,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
//type类型 //type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息 // 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
uni.navigateTo({ uni.navigateTo({
url: url: 'pages/order/detail?id=' + item.orderId + '&type=' + type + '&showCountTime=' + showCountTime
'pages/order/detail?id=' + });
item.orderId +
'&type=' +
type +
'&showCountTime=' +
showCountTime,
})
}, },
handleClickSearch() { handleClickSearch() {
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/search', url: 'pages/order/search'
}) });
}, },
onRefresh() { onRefresh() {
if (this._freshing) return if (this.freshing) return;
this._freshing = true this.freshing = true;
this.reloadOrderInfo() this.reloadOrderInfo();
}, },
onRestore() { onRestore() {
this.triggered = 'restore' // 需要重置 this.triggered = 'restore'; // 需要重置
}, },
reloadOrderInfo() { reloadOrderInfo() {
this.reloadOrderList() this.reloadOrderList();
this.getOrderCount() this.getOrderCount();
}, },
reloadOrderList() { reloadOrderList() {
this.pageNumber = 0 this.pageNumber = 0;
this.loadStatus = 'loading' this.loadStatus = 'loading';
this.getOrderList() this.getOrderList();
}, },
scroll(e) { scroll(e) {
this.old.scrollTop = e.detail.scrollTop this.old.scrollTop = e.detail.scrollTop;
}, },
goTop(e) { goTop(e) {
this.scrollTop = this.old.scrollTop this.scrollTop = this.old.scrollTop;
this.$nextTick(function() { this.$nextTick(function() {
this.scrollTop = 0 this.scrollTop = 0;
}) });
}, },
// 显示提示蒙版 // 显示提示蒙版
showMaskTip() { showMaskTip() {
this.showMask = true this.showMask = true;
}, }
}, }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
<view class="xh-select" :style="{ width: width }"> <view class="xh-select" :style="{ width: width }">
<view class="u-flex u-row-between picker-common" :class="{ border: border }" :style="{ background: background }"> <view class="u-flex u-row-between picker-common" :class="{ border: border }" :style="{ background: background }">
<picker mode="selector" :value="index" :range-key="rangeKey" :range="list" @click="onOpen" @change="pickerChange" @cancel="close" class="u-flex-1" :disabled="disabled"> <picker mode="selector" :value="index" :range-key="rangeKey" :range="list" @click="onOpen" @change="pickerChange" @cancel="close" class="u-flex-1" :disabled="disabled">
<view class="txt">{{ text || placeholder }}</view> <view class="txt">
<view class="text-inner">
{{ text || placeholder }}
</view>
</view>
</picker> </picker>
<u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon> <u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
</view> </view>
...@@ -121,7 +125,6 @@ export default { ...@@ -121,7 +125,6 @@ export default {
border-radius: 6px; border-radius: 6px;
color: #333333; color: #333333;
padding-left: 10px; padding-left: 10px;
padding-right: 50rpx;
width: 100%; width: 100%;
height: 36px; height: 36px;
.u-flex-1 { .u-flex-1 {
...@@ -129,11 +132,15 @@ export default { ...@@ -129,11 +132,15 @@ export default {
.txt { .txt {
font-size: 14px; font-size: 14px;
width: 100%; width: 100%;
.text-inner{
padding-right: 50rpx;
width: 100%;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
} }
}
} }
.border { .border {
border: 2upx solid #eeeeee; border: 2upx solid #eeeeee;
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
<view class="goods-count"> <view class="goods-count">
<view class="goods-count-item"> <view class="goods-count-item">
<view class="goods-count-item-title">充电桩库存量</view> <view class="goods-count-item-title">充电桩库存量</view>
<view class="goods-count-item-count">{{inventoryCount}}</view> <view class="goods-count-item-count">{{signCount}}</view>
</view> </view>
<view class="goods-count-line"></view> <view class="goods-count-line"></view>
<view class="goods-count-item"> <view class="goods-count-item">
<view class="goods-count-item-title">充电桩盘点量</view> <view class="goods-count-item-title">充电桩盘点量</view>
<view class="goods-count-item-count">{{checkCount}}</view> <view class="goods-count-item-count">{{takeCount}}</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
export default { export default {
name: 'GoodsCount', name: 'GoodsCount',
props:{ props:{
inventoryCount:{ signCount:{
type:Number, type:Number,
default:0 default:0
}, },
checkCount:{ takeCount:{
type:Number, type:Number,
default:0 default:0
}, },
......
...@@ -4,54 +4,61 @@ ...@@ -4,54 +4,61 @@
<view class="tools-box-left"> <view class="tools-box-left">
<view class="tools-box-left-title">选择品牌</view> <view class="tools-box-left-title">选择品牌</view>
<view class="tools-box-left-select"><xh-picker-select background="#f4f5f7" placeholder="全部" :rangeKey="rangeKey" :value="value" :list="brandList" @change="pickerchange"></xh-picker-select></view> <view class="tools-box-left-select">
<xh-picker-select background="#f4f5f7" placeholder="全部" :rangeKey="rangeKey" :value="value" :list="brandList" @change="pickerchange"></xh-picker-select>
</view> </view>
<view class="tools-box-navi">
<xh-button @handleClick="naviTo" text="去盘点"></xh-button>
</view> </view>
<view class="tools-box-navi"><xh-button :disabled="buttonShow" @handleClick="naviTo" text="去盘点"></xh-button></view>
</view> </view>
</template> </template>
<script> <script>
import XhPickerSelect from '../XhPickerSelect.vue'; import XhPickerSelect from '../XhPickerSelect.vue';
import XhButton from "@/components/mine/xh-button.vue" import XhButton from '@/components/mine/xh-button.vue';
import { receiveStatusOptions } from '@/common/optinos/mine/received.js'; import { showToast } from '@/common/common.js';
export default { export default {
props: ['current','value'], props: {
current: {
type: Number | null
},
value: {
type: Number | null
},
takeStatus: {
type: Number | null,
default: 9
}
},
components: { components: {
XhPickerSelect, XhPickerSelect,
XhButton XhButton
}, },
data() { data() {
return { return {
receiveStatusOptions, rangeKey: 'name',
rangeKey:"name", brandList: []
brandList: [
{
id:0,
name:'全部',
},
{
id:982,
name:'长城',
},
],
}; };
}, },
computed: {
buttonShow() {
return this.takeStatus !== 0 && this.takeStatus !== 1;
}
},
methods: { methods: {
// 获取品牌列表 // 获取品牌列表
async getBrandList() { async getBrandList() {
let res = await this.$u.api.brandListByReceivedModules(); let res = await this.$u.api.brandListByReceivedModules();
let { code, data } = res; let { code, data, message } = res;
if (code === 200){ if (code === 200) {
this.brandList = data || []; this.brandList = data || [];
} else {
showToast(message);
} }
}, },
pickerchange(data) { pickerchange(data) {
this.$emit('pickerchange', data); this.$emit('pickerchange', data);
}, },
naviTo(){ naviTo() {
this.$emit('toAdd'); this.$emit('toAdd');
} }
} }
...@@ -66,27 +73,27 @@ export default { ...@@ -66,27 +73,27 @@ export default {
align-items: center; align-items: center;
margin-bottom: 30rpx; margin-bottom: 30rpx;
height: 100rpx; height: 100rpx;
background-color: #FFFFFF; background-color: #ffffff;
padding: 0 30rpx; padding: 0 30rpx;
border-radius: 12rpx; border-radius: 12rpx;
&-left{ &-left {
display: flex; display: flex;
align-items: center; align-items: center;
&-title{ &-title {
width: 120rpx; width: 120rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
margin-right: 20rpx; margin-right: 20rpx;
} }
&-select{ &-select {
width: 240rpx; width: 240rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 8rpx; border-radius: 8rpx;
} }
} }
&-navi{ &-navi {
width: 180rpx; width: 180rpx;
} }
} }
......
<template> <template>
<uni-swipe-action-item :right-options="rightOptions" @click.stop="swipeClick" > <uni-swipe-action-item :right-options="rightOptions" @click.stop="swipeClick">
<view class="receiving-info" @click.stop="handleClick"> <view class="receiving-info" @click.stop="handleClick">
<view class="receiving-info-content"> <view class="receiving-info-content">
<text class="receiving-info-content-left">箱码</text> <text class="receiving-info-content-left">箱码</text>
<text class="receiving-info-content-right">{{ detail.code }}</text> <text class="receiving-info-content-right">{{ detail.productCode }}</text>
</view> </view>
<view class="receiving-info-content"> <view class="receiving-info-content">
<text class="receiving-info-content-left">状态</text> <text class="receiving-info-content-left">状态</text>
<text class="receiving-info-content-right" :class="[statusColor]">{{ statusLabel }}</text> <text class="receiving-info-content-right" :style="{ color: statusColor }">{{ takeStatusLabel }}</text>
</view> </view>
</view> </view>
</uni-swipe-action-item> </uni-swipe-action-item>
</template> </template>
<script> <script>
import { myFilter } from '@/common/common.js'; import { statusColorOptions } from '@/common/optinos/mine/received.js';
import { receiveStatusOptions } from '@/common/optinos/mine/received.js'; import { takeDetailStatusOptions } from '@/common/optinos/mine/inventory.js';
import { showModal } from '@/common/common.js'; import { showModal,myFilter } from '@/common/common.js';
export default { export default {
name: 'ReceivingInfo', name: 'ReceivingInfo',
props: { props: {
...@@ -26,17 +26,14 @@ export default { ...@@ -26,17 +26,14 @@ export default {
}, },
/* 品牌类型 */ /* 品牌类型 */
options: { options: {
type: Array|null, type: Array | null,
default: () => [] default: () => []
} }
}, },
data() { data() {
return { return {
receiveStatusOptions, takeDetailStatusOptions,
statusColorOptions: { statusColorOptions,
1: 'receiving-info-footer-status-grey',
2: 'receiving-info-footer-status-blue'
},
rightOptions: [ rightOptions: [
{ {
text: '取消', text: '取消',
...@@ -55,11 +52,10 @@ export default { ...@@ -55,11 +52,10 @@ export default {
}, },
computed: { computed: {
statusColor() { statusColor() {
return this.statusColorOptions[this.detail.status] || ''; return this.statusColorOptions[this.takeStatusLabel] || '';
}, },
statusLabel() { takeStatusLabel(){
// 按钮文字 return myFilter(this.detail.status, this.takeDetailStatusOptions);
return myFilter(this.detail.status, this.receiveStatusOptions, 'name');
}, },
brandLabel() { brandLabel() {
return myFilter(this.detail.brand, this.options); return myFilter(this.detail.brand, this.options);
...@@ -78,14 +74,14 @@ export default { ...@@ -78,14 +74,14 @@ export default {
}, },
handleClick() { handleClick() {
this.$emit('handleClick', this.detail.id); this.$emit('handleClick', this.detail.detailId);
}, },
openDelete(index) { openDelete(index) {
showModal({ showModal({
content: '删除车辆后,将无法收到车辆信息,是否删除该车辆?', content: '是否删除该数据?',
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
this.$emit('handleDelete', this.detail.id ); this.$emit('handleDelete', this.detail.detailId);
} }
} }
}); });
......
...@@ -73,8 +73,8 @@ export default { ...@@ -73,8 +73,8 @@ export default {
let { scanType, result } = res; let { scanType, result } = res;
console.log('类型:' + scanType); console.log('类型:' + scanType);
console.log('内容:' + result); console.log('内容:' + result);
this.dataValue = result; this.dataValue = result.substring(0,200);
this.$emit('onBarCodeChange', result); this.$emit('onBarCodeChange', this.dataValue);
} }
}); });
}, },
......
<template>
<view class="receive-images">
<view class="title-view">
<view class="title-left-view" >
<text>{{ uploadForm.label }}</text>
</view>
<view class="info-tip-text" v-if="!disabled">{{ uploadForm.tips }}</view>
<view class="image-view">
<block v-for="(item, key) in uploadForm.imgs" :key="key">
<view class="info-image-box" v-if="key < uploadForm.count">
<image class="info-image-box-inner" mode="aspectFill" v-if="item.path" :src="item.path" @click="perview(key)"></image>
<view class="info-image-box-close" v-if="!disabled" @click="removeImage(key)"><u-icon name="close"></u-icon></view>
</view>
</block>
<view class="info-image-box" @click="handleClick" v-if="!disabled&&uploadForm.imgs.length < uploadForm.count">
<view class="info-image-box-add"><u-icon name="plus"></u-icon></view>
</view>
</view>
<view v-if="!disabled&&uploadForm.imgs.length == 0" class="bottom-tip-view">
<image class="bottom-tip-image" mode="widthFix" :src="tishiImage"></image>
<text>最少上传一张箱码照片</text>
</view>
</view>
</view>
</template>
<script>
import base from '@/components/upload/index';
export default {
name: 'ReceiveImages',
mixins: [base],
props: {
disabled: {
type: Boolean,
default: false,
},
},
data() {
return {
tishiImage: process.uniEnv.qn_base_url + 'tishi.png',
uploadForm: {
filedName: '',
count: 3,
label: '箱码照片',
tips: '上传箱码照片',
imgs: []
}
};
},
computed: {},
created() {},
mounted() {
this.initImages();
},
methods: {
initImages(images) {
this.uploadForm.imgs = images || [];
console.log(this.uploadForm.imgs)
},
valueChange(e) {
this.$emit('onScanCodeChange', e);
},
async handleClick() {
if(this.disabled) return false;
let { count, imgs } = this.uploadForm;
// let imgCount=count-imgs.length;
// 已满3张不能再上传
if (imgs.length === count) {
return false;
}
let imgList = await this.chooseImg({ count: 1, size: ['compressed'] });
this.uploadForm.imgs.push(...imgList);
console.log(this.uploadForm.imgs)
this.updateImages();
},
// 预览
perview(index) {
let urls = this.uploadForm.imgs.map(item => {
return item.path;
});
uni.previewImage({
current: index,
urls: urls
});
},
removeImage(index) {
this.uploadForm.imgs.splice(index, 1);
this.updateImages();
},
updateImages() {
this.$emit('updateImages', this.uploadForm.imgs);
}
}
};
</script>
<style lang="scss" scoped>
.receive-images {
background-color: #ffffff;
border-radius: 12rpx;
padding: 20rpx 30rpx;
margin-bottom: 20rpx;
color: #333333;
.title-view {
font-size: 32rpx;
.title-left-view {
font-weight: bold;
}
.info-tip-text {
font-size: 24rpx;
color: #666666;
margin-top: 10rpx;
}
}
.bottom-tip-view {
color: #999999;
font-size: 20rpx;
display: flex;
align-items: flex-start;
margin-top: 30rpx;
}
.bottom-tip-image {
width: 22rpx;
height: 22rpx;
margin-right: 8rpx;
margin-top: 4rpx;
flex-shrink: 0;
}
.image-view {
margin-top: 30rpx;
display: flex;
.info-image-box {
width: 216rpx;
height: 216rpx;
background-color: #cccccc;
position: relative;
margin-right: 20rpx;
border-radius: 12rpx;
&:last-child {
margin-right: 0;
}
}
.info-image-box-inner {
border-radius: 12rpx;
overflow: hidden;
width: 100%;
height: 100%;
}
.info-image-box-close {
width: 38rpx;
height: 38rpx;
border-radius: 50%;
background-color: #666666;
font-size: 22rpx;
line-height: 38rpx;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: -8rpx;
right: -8rpx;
z-index: 1;
}
.info-image-box-add {
width: 100%;
height: 100%;
font-size: 120rpx;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
}
}
}
</style>
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
computed: {}, computed: {},
created() {}, created() {},
mounted() { mounted() {
this.initImages(); // this.initImages();
}, },
methods: { methods: {
initImages(images) { initImages(images) {
...@@ -69,9 +69,9 @@ export default { ...@@ -69,9 +69,9 @@ export default {
if (imgs.length === count) { if (imgs.length === count) {
return false; return false;
} }
let imgList = await this.chooseImg({ count: 1, size: ['compressed'] }); // size: ["original",'compressed']
let imgList = await this.chooseImg({ count: 1 });
this.uploadForm.imgs.push(...imgList); this.uploadForm.imgs.push(...imgList);
console.log(this.uploadForm.imgs)
this.updateImages(); this.updateImages();
}, },
// 预览 // 预览
......
...@@ -80,8 +80,8 @@ export default { ...@@ -80,8 +80,8 @@ export default {
console.log('类型:' + scanType); console.log('类型:' + scanType);
console.log('内容:' + result); console.log('内容:' + result);
if (scanType === 'QR_CODE') { if (scanType === 'QR_CODE') {
this.dataValue = result; this.dataValue = result.substring(0,200);
this.$emit("onScanCodeChange",result) this.$emit("onScanCodeChange",this.dataValue)
} }
} }
}); });
......
...@@ -22,15 +22,16 @@ ...@@ -22,15 +22,16 @@
<script> <script>
import XhPickerSelect from '../XhPickerSelect.vue'; import XhPickerSelect from '../XhPickerSelect.vue';
import { receiveStatusOptions } from '@/common/optinos/mine/received.js'; import { receiveStatusOptions } from '@/common/optinos/mine/received.js';
import { showToast } from '@/common/common.js';
export default { export default {
props: ['current','value'], props: ['current', 'value'],
components: { components: {
XhPickerSelect XhPickerSelect
}, },
data() { data() {
return { return {
receiveStatusOptions, receiveStatusOptions,
rangeKey:"name", rangeKey: 'name',
brandList: [] brandList: []
}; };
}, },
...@@ -38,9 +39,11 @@ export default { ...@@ -38,9 +39,11 @@ export default {
// 获取品牌列表 // 获取品牌列表
async getBrandList() { async getBrandList() {
let res = await this.$u.api.brandListByReceivedModules(); let res = await this.$u.api.brandListByReceivedModules();
let { code, data } = res; let { code, data, message } = res;
if (code === 200){ if (code === 200) {
this.brandList = data || []; this.brandList = data || [];
} else {
showToast(message);
} }
}, },
// tab栏切换 // tab栏切换
......
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
<text class="receiving-info-content-right">{{ detail.brandName }}</text> <text class="receiving-info-content-right">{{ detail.brandName }}</text>
</view> </view>
<view class="receiving-info-footer"> <view class="receiving-info-footer">
<view :class="[statusColor]">{{ detail.status }}</view> <view :class="[statusColor]">{{ statusLabel }}</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { myFilter } from '@/common/common.js'; import { myFilter } from '@/common/common.js';
import { receiveStatusOptions } from '@/common/optinos/mine/received.js'; import { statusOptions } from '@/common/optinos/mine/received.js';
export default { export default {
name: 'ReceivingInfo', name: 'ReceivingInfo',
props: { props: {
...@@ -27,23 +27,23 @@ export default { ...@@ -27,23 +27,23 @@ export default {
}, },
data() { data() {
return { return {
receiveStatusOptions statusOptions
}; };
}, },
computed: { computed: {
statusColor() { statusColor() {
return this.detail.status === "已使用" ? 'receiving-info-footer-status-grey' : 'receiving-info-footer-status-blue'; return this.detail.status === "1" ? 'receiving-info-footer-status-grey' : 'receiving-info-footer-status-blue';
}, },
statusLabel() { statusLabel() {
// 按钮文字 // 按钮文字
return myFilter(this.detail.status, this.receiveStatusOptions, 'name'); return myFilter(this.detail.status, this.statusOptions);
}, },
}, },
created() {}, created() {},
methods: { methods: {
handleClick() { handleClick() {
this.$emit('handleClick', this.detail.id); this.$emit('handleClick', this.detail.signId);
} }
} }
}; };
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
enable-back-to-top enable-back-to-top
> >
<!-- 加载中 && 没有下拉:显示加载中 --> <!-- 加载中 && 没有下拉:显示加载中 -->
<view class="loading-view" v-if="!loaded && _freshing"><u-loading mode="flower"></u-loading></view> <view class="loading-view" v-if="!loaded && freshing"><u-loading mode="flower"></u-loading></view>
<!-- 无数据 --> <!-- 无数据 -->
<NoOrder v-else-if="noParts" imageName="wupeijianxinxi.png" text="当前暂无物料信息" :customStyle="noPartsCustomStyle" /> <NoOrder v-else-if="noParts" imageName="wupeijianxinxi.png" text="当前暂无物料信息" :customStyle="noPartsCustomStyle" />
<template v-else> <template v-else>
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
loadStatus: 'loading', // 底部加载状态 loadStatus: 'loading', // 底部加载状态
loaded: false, // 页面加载 loaded: false, // 页面加载
triggered: true, // true:下拉刷新 triggered: true, // true:下拉刷新
_freshing: false, // 防止下拉刷新重复触发 freshing: false, // 防止下拉刷新重复触发
buttonType: 'expand' // 申请按钮宽 collapse': '80rpx', 'expand': '220rpx'' buttonType: 'expand' // 申请按钮宽 collapse': '80rpx', 'expand': '220rpx''
}; };
}, },
...@@ -157,7 +157,7 @@ export default { ...@@ -157,7 +157,7 @@ export default {
// 跳转到第几个tab页 // 跳转到第几个tab页
this.currentIndex = e.index; this.currentIndex = e.index;
} }
this._freshing = false; this.freshing = false;
this.reloadPartsList(); // 加载数据 this.reloadPartsList(); // 加载数据
}, },
onShow() { onShow() {
...@@ -204,9 +204,9 @@ export default { ...@@ -204,9 +204,9 @@ export default {
} }
this.$nextTick(() => { this.$nextTick(() => {
// 页面刷新完之后更新下拉状态 // 页面刷新完之后更新下拉状态
if (this._freshing) { if (this.freshing) {
this.triggered = false; this.triggered = false;
this._freshing = false; this.freshing = false;
} }
}); });
this.loaded = true; // 加载完成 this.loaded = true; // 加载完成
...@@ -270,8 +270,8 @@ export default { ...@@ -270,8 +270,8 @@ export default {
}, },
// 下拉刷新 // 下拉刷新
onRefresh() { onRefresh() {
if (this._freshing) return; if (this.freshing) return;
this._freshing = true; this.freshing = true;
this.reloadPartsList(); this.reloadPartsList();
}, },
// 重置下拉状态 // 重置下拉状态
......
<template> <template>
<!-- 收货列表 --> <!-- 收货列表 -->
<view class="ware-house"> <view class="ware-house" @click="closeAll">
<u-navbar back-icon-color="#333333" background="#FFFFFF" title="盘点" titleColor="#333333" :border-bottom="false" title-bold></u-navbar> <u-navbar back-icon-color="#333333" background="#FFFFFF" title="盘点" titleColor="#333333" :border-bottom="false" title-bold></u-navbar>
<inventory-head ref="inventory-head" @toAdd="toAdd" :value="form.brandId" @pickerchange="pickerchange"></inventory-head> <inventory-head ref="inventory-head" @toAdd="toAdd" :takeStatus="takeStatus" :value="form.brandId" @pickerchange="pickerchange"></inventory-head>
<goods-count :inventoryCount="inventoryCount" :checkCount="checkCount"></goods-count> <goods-count :signCount="signCount" :takeCount="takeCount"></goods-count>
<!-- 列表 --> <!-- 列表 -->
<view class="tab-view" @click="closeAll"> <view class="tab-view">
<scroll-view <scroll-view
scroll-y scroll-y
style="height: 100%;width: 100%;" style="height: 100%;width: 100%;"
@scrolltolower="reachBottom"
scroll-anchoring scroll-anchoring
refresher-enabled="true" refresher-enabled="true"
:refresher-triggered="triggered" :refresher-triggered="triggered"
:refresher-threshold="100" :refresher-threshold="100"
:scroll-top="scrollTop"
refresher-background="#F4F5F7" refresher-background="#F4F5F7"
@refresherrefresh="onRefresh" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @refresherrestore="onRestore"
@scroll="scroll"
enable-back-to-top enable-back-to-top
> >
<NoOrder v-if="noParts" imageName="zwdd.png" :customStyle="noOrderCustomStyle" /> <NoOrder v-if="noParts" imageName="zwdd.png" text="暂无数据" :customStyle="noOrderCustomStyle" />
<template v-else> <template v-else>
<uni-swipe-action ref="uni-swipe-action"> <uni-swipe-action ref="uni-swipe-action">
<view class="swipe-action" v-for="(item, index) in list" :key="item.id"> <view class="swipe-action" v-for="(item, index) in list" :key="item.detailId">
<inventory-info :detail="item" :options="brandList" @handleClick="handleClick" @handleDelete="handleDelete"></inventory-info> <inventory-info :detail="item" :options="brandList" @handleClick="handleClick" @handleDelete="handleDelete"></inventory-info>
</view> </view>
</uni-swipe-action> </uni-swipe-action>
<view class="load-more-view" v-show="(form.pageNumber == 1 && loaded) || form.pageNumber > 1"><u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore></view>
</template> </template>
<view class="loading-view" v-if="!loaded && !freshing"><u-loading mode="flower"></u-loading></view> <view class="loading-view" v-if="!loaded && !freshing"><u-loading mode="flower"></u-loading></view>
</scroll-view> </scroll-view>
</view> </view>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<fixed-button text="确认盘点" @handleClick="confirm"></fixed-button> <fixed-button :disabled="disabled" :text="fixedButtonTxt" @handleClick="submit"></fixed-button>
<!-- 通用提示框 --> <!-- 通用提示框 -->
<view><u-toast ref="uToast" /></view> <view><u-toast ref="uToast" /></view>
</view> </view>
...@@ -50,6 +45,8 @@ import InventoryInfo from './components/inventory/inventoryInfo.vue'; ...@@ -50,6 +45,8 @@ import InventoryInfo from './components/inventory/inventoryInfo.vue';
import NoOrder from '@/components/order/noOrder.vue'; import NoOrder from '@/components/order/noOrder.vue';
import ApplyButton from '@/components/parts/applyButton.vue'; import ApplyButton from '@/components/parts/applyButton.vue';
import { receiveStatusOptions } from '@/common/optinos/mine/received.js'; import { receiveStatusOptions } from '@/common/optinos/mine/received.js';
import { inventoryStatusOptions } from '@/common/optinos/mine/inventory.js';
import { showToast, showModal, myFilter } from '@/common/common.js';
export default { export default {
components: { components: {
inventoryHead, inventoryHead,
...@@ -62,56 +59,27 @@ export default { ...@@ -62,56 +59,27 @@ export default {
data() { data() {
return { return {
receiveStatusOptions, receiveStatusOptions,
inventoryStatusOptions, // 盘点状态
list: [ list: [], // 物料订单列表
{ id: 1, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 2, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 3, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 4, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 5, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 6, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 7, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 8, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 9, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 10, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 11, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 12, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 13, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 14, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 15, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 16, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 17, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 18, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 19, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 20, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 21, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 22, status: 1, code: 'dsadq4231', brand: 'byd', show: false },
{ id: 23, status: 1, code: 'dsadq4231', brand: 'byd', show: false }
], // 物料订单列表
form: { form: {
pageNumber: 0, brandId: ''
pageSize: 10,
brandId: '',
}, },
show: false, show: false,
loadStatus: 'loading', // 底部加载状态
loaded: false, // 页面加载 loaded: false, // 页面加载
triggered: true, // true:下拉刷新 triggered: true, // true:下拉刷新
freshing: false, // 防止下拉刷新重复触发 freshing: false, // 防止下拉刷新重复触发
buttonType: 'expand', // 申请按钮宽 collapse': '80rpx', 'expand': '220rpx'' stock: {
scrollTop: 0, takeId: '',
old: { takeStatus: '' // 盘点中 已提交 盘点完成 申请重盘
scrollTop: 0
}, },
buttonStyle: { signCount: 0, // 库存数量
width: '100%', takeCount: 0, // 当前盘点数量
height: '80rpx', takeStatusOptions: {
fontSize: '32rpx', 0: '去盘点',
fontWeight: 'bold' 1: '确认盘点',
}, 2: '申请重盘',
inventoryCount: 0, 3: '已完成'
checkCount: 0 }
}; };
}, },
computed: { computed: {
...@@ -122,6 +90,28 @@ export default { ...@@ -122,6 +90,28 @@ export default {
// 无数据页面样式 // 无数据页面样式
noPartsCustomStyle() { noPartsCustomStyle() {
return 'margin-top: 100rpx;background-color: #F4F5F7'; return 'margin-top: 100rpx;background-color: #F4F5F7';
},
takeStatus() {
let status;
switch (this.stock.takeStatus) {
case '1':
case '2':
status = 2;
break;
case '3':
status = 3;
break;
default:
status = 1;
break;
}
return status;
},
fixedButtonTxt() {
return this.takeStatusOptions[this.takeStatus];
},
disabled() {
return this.stock.takeStatus === '3' ? true : false;
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -130,6 +120,7 @@ export default { ...@@ -130,6 +120,7 @@ export default {
// // 跳转到第几个tab页 // // 跳转到第几个tab页
// this.currentIndex = e.index; // this.currentIndex = e.index;
// } // }
this.getBrandList();
this.freshing = false; this.freshing = false;
this.reloadList(); // 加载数据 this.reloadList(); // 加载数据
}, },
...@@ -144,32 +135,36 @@ export default { ...@@ -144,32 +135,36 @@ export default {
}, },
methods: { methods: {
pickerchange(data) { pickerchange(data) {
this.form.brandId = data.id||""; this.form.brandId = data.id || '';
if (data.name === '全部') {
this.form.brandName = '';
} else {
this.form.brandName = data.name || '';
}
this.reloadList(); this.reloadList();
}, },
// 获取品牌列表 // 获取品牌列表
getBrandList(){ getBrandList() {
this.$refs["inventory-head"].getBrandList() this.$refs['inventory-head'].getBrandList();
}, },
// 页面数据:未入库 // 页面数据:未入库
async getList() { async getList(noReset = false) {
// 状态处理 // 状态处理
this.form.pageNumber += 1;
if (this.form.pageNumber == 1) {
this.loaded = false; this.loaded = false;
} var param = this.form;
var param = this.form let res = await this.$u.api.inventoryListByInventoryModules(param);
let res = await this.$u.api.inventoryListByReceivedModules(param);
if (res.code == 200) { if (res.code == 200) {
if (this.form.pageNumber == 1) { let { list, count, signCount, stock, takeCount } = res.data;
this.list = []; if (!noReset) {
let arr = list || [];
arr.forEach(item => (item.show = false));
this.list = arr;
} }
let list = res.data || []; this.stock = stock;
list.forEach(item => (item.show = false)); this.signCount = signCount;
this.list.push(...list); this.takeCount = takeCount;
this.loadStatus = list.length < this.pageSize ? 'nomore' : 'loadmore'; // 底部加载状态
} else { } else {
// this.loadStatus = 'loadmore'; showToast(res.message);
console.log(res.message); console.log(res.message);
} }
this.$nextTick(() => { this.$nextTick(() => {
...@@ -183,8 +178,11 @@ export default { ...@@ -183,8 +178,11 @@ export default {
}, },
// 跳转到详情 // 跳转到详情
handleClick(id) { handleClick(id) {
let url = 'pages/mine/warehouse/inventoryDetail'; if (!this.stock.takeId) {
if (id) url += `?id=${id}`; return false;
}
let url = `pages/mine/warehouse/inventoryDetail?takeId=${this.stock.takeId}`;
if (id) url += `&id=${id}`;
uni.navigateTo({ uni.navigateTo({
url url
}); });
...@@ -193,14 +191,6 @@ export default { ...@@ -193,14 +191,6 @@ export default {
toAdd() { toAdd() {
this.handleClick(); this.handleClick();
}, },
// 本页数据设置,用于其他页面访问本页数据
setPageInfo(info) {
var pages = getCurrentPages();
if (pages.length >= 1) {
var page = pages[pages.length - 1];
page.info = info;
}
},
// 下拉刷新 // 下拉刷新
onRefresh() { onRefresh() {
if (this.freshing) return; if (this.freshing) return;
...@@ -214,33 +204,74 @@ export default { ...@@ -214,33 +204,74 @@ export default {
// 初始化加载 // 初始化加载
reloadList() { reloadList() {
// 第一页数据 // 第一页数据
this.form.pageNumber = 0;
this.loadStatus = 'loading';
this.getList();
},
// 滚到底部加载下一页
reachBottom(e) {
if (this.loadStatus != 'loadmore') return;
this.loadStatus == 'loading';
this.getList(); this.getList();
}, },
scroll(e) {
// this.old.scrollTop = e.detail.scrollTop;
},
closeAll() { closeAll() {
if (this.list.length) { if (this.list.length) {
this.$refs['uni-swipe-action'].closeOther(undefined); this.$refs['uni-swipe-action'].closeOther(undefined);
} }
}, },
async handleDelete(id) { async handleDelete(id) {
if (this.stock.takeStatus !== '0') {
showToast('盘点已提交,无法删除');
return false;
}
console.log('删除--', id); console.log('删除--', id);
// let {code,data}=await onDelete(id) let { code, message } = await this.$u.api.deleteInventoryByInventoryModules(id);
if (code === 200) {
showToast('操作成功');
setTimeout(() => {
this.reloadList();
}, 1200);
} else {
showToast(message);
}
}, },
// 确认盘点 // 提交
submit() {
let content = '';
if (this.stock.takeStatus === '0') {
content = '是否提交所有盘点?';
} else if (this.stock.takeStatus === '1') {
content = '是否申请重新盘点?';
} else {
if (this.stock.takeStatus === '2') {
showToast('已申请重新盘点,请等待审核');
}
return false;
}
showModal({
content,
success: res => {
if (res.confirm) {
if (this.stock.takeStatus === '0') {
this.confirm();
} else if (this.stock.takeStatus === '1') {
this.applyReInventory();
}
}
}
});
},
// 确认提交盘点
async confirm() { async confirm() {
if (this.list.length) { let { code, message } = await this.$u.api.confirmInventoryByInventoryModules(this.stock.takeId);
// let res=await confirmSubmit() if (code === 200) {
showToast('操作成功');
this.getList(true);
} else {
showToast(message);
}
},
// 申请重新盘点
async applyReInventory() {
let { code, message } = await this.$u.api.confirmInventoryByInventoryModules(this.stock.takeId);
if (code === 200) {
showToast('已申请重盘');
} else {
showToast(message);
} }
await this.getList(true);
} }
} }
}; };
......
<template> <template>
<!-- 收货详情 --> <!-- 收货详情 -->
<view class="ware-house"> <view class="ware-house">
<u-navbar back-icon-color="#333333" background="#FFFFFF" title="盘点" titleColor="#333333" :border-bottom="false" title-bold></u-navbar> <u-navbar back-icon-color="#333333" :background="{ backgroundColor: '#F4F5F7' }" title="盘点" titleColor="#333333" :border-bottom="false" title-bold></u-navbar>
<view class="tools-box"> <view class="tools-box">
<text class="tools-box-title">品牌</text> <text class="tools-box-title">品牌</text>
<view class="select-view"> <view class="select-view">
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
</view> </view>
<!-- 列表 --> <!-- 列表 -->
<view class="tab-view"> <view class="tab-view">
<receive-qr-code @onScanCodeChange="onScanCodeChange"></receive-qr-code> <receive-qr-code :disabled="disabled" :value="form.productCode" @onScanCodeChange="onScanCodeChange"></receive-qr-code>
<receive-images ref="receive-images" @updateImages="updateImages"></receive-images> <receive-images ref="receive-images" :value="form.image" :disabled="disabled" @updateImages="updateImages"></receive-images>
</view> </view>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<fixed-button text="保存并下一个" @handleClick="submit"></fixed-button> <fixed-button text="保存并下一个" @handleClick="submit" v-if="!disabled"></fixed-button>
<!-- 通用提示框 --> <!-- 通用提示框 -->
<view><u-toast ref="uToast" /></view> <view><u-toast ref="uToast" /></view>
</view> </view>
...@@ -36,7 +36,7 @@ import FixedButton from '@/components/mine/fixed-button.vue'; ...@@ -36,7 +36,7 @@ import FixedButton from '@/components/mine/fixed-button.vue';
import ReceiveQrCode from './components/receiveDetail/receiveQrCode.vue'; import ReceiveQrCode from './components/receiveDetail/receiveQrCode.vue';
import ReceiveImages from './components/receiveDetail/receiveImages.vue'; import ReceiveImages from './components/receiveDetail/receiveImages.vue';
import { receiveStatusOptions } from '@/common/optinos/mine/received.js'; import { receiveStatusOptions } from '@/common/optinos/mine/received.js';
import { showToast } from '@/common/common.js'; import { showToast,setNeedRefresh } from '@/common/common.js';
export default { export default {
components: { components: {
XhPickerSelect, XhPickerSelect,
...@@ -48,16 +48,8 @@ export default { ...@@ -48,16 +48,8 @@ export default {
return { return {
receiveStatusOptions, receiveStatusOptions,
rangeKey: 'name', rangeKey: 'name',
brandList: [ disabled:false,
{ brandList: [],
id: 0,
name: '全部'
},
{
id: 982,
name: '长城'
}
],
form: { form: {
id: '', id: '',
takeId: '', takeId: '',
...@@ -71,42 +63,53 @@ export default { ...@@ -71,42 +63,53 @@ export default {
computed: {}, computed: {},
onLoad(e) { onLoad(e) {
this.getBrandList(); this.getBrandList();
if (e && e.id) { console.log(e)
this.form.id = e.id; if (e) {
let {id,takeId}=e
this.form.takeId = takeId;
if(id){
this.form.id = id;
this.getDetail(); this.getDetail();
this.disabled = true; this.disabled = true;
} }
}
}, },
onShow() {}, onShow() {},
methods: { methods: {
pickerchange(data) { pickerchange(data) {
this.form.brandId = data.id; this.form.brandId = data.id;
this.form.brandName = data.brandName; this.form.brandName = data.name;
}, },
onScanCodeChange(data) { onScanCodeChange(data) {
this.form.productCode = data; this.form.productCode = data;
}, },
updateImages(data) { updateImages(data) {
let image = data.map(item => process.uniEnv.qn_asset_url + '/' + item.src + '?imageView2/1/w/100/h/100/q/75'); let image = data.map(item => process.uniEnv.qn_asset_url + '/' + item.src);
// + '?imageView2/1/w/100/h/100/q/75' 添加此项为图片参数,配置大小
this.form.image = image.join(";"); this.form.image = image.join(";");
}, },
// 获取品牌列表 // 获取品牌列表
async getBrandList() { async getBrandList() {
let res = await this.$u.api.brandListByReceivedModules(); let res = await this.$u.api.brandListByReceivedModules();
let { code, data } = res; let { code, data,message } = res;
if (code === 200) { if (code === 200) {
this.brandList = data || []; this.brandList = data || [];
}else{
showToast(message);
} }
}, },
async getDetail() { async getDetail() {
let res = await this.$u.api.inventoryDetailByInventoryModules(this.form.id); let res = await this.$u.api.inventoryDetailByInventoryModules(this.form.id);
let { code, data } = res; let { code, data,message } = res;
if (code === 200) { if (code === 200) {
let image = data.image.split(';').map(item => { let image = data.image.split(';').map(item => {
return { path: item }; return { path: item };
}); });
this.$refs['receive-images'].initImages(image); this.$refs['receive-images'].initImages(image);
this.form = Object.assign(this.form, data); this.form = Object.assign(this.form, data);
}else{
showToast(message);
} }
}, },
submit() { submit() {
...@@ -128,18 +131,21 @@ export default { ...@@ -128,18 +131,21 @@ export default {
}, },
async createdReceive(form) { async createdReceive(form) {
let res=await this.$u.api.addInventoryByInventoryModules(form) let res=await this.$u.api.addInventoryByInventoryModules(form)
let { code, data } = res; let { code, data,message } = res;
if (code === 200) { if (code === 200) {
showToast('操作成功'); showToast('操作成功');
setNeedRefresh()
setTimeout(() => { setTimeout(() => {
this.replacePage() this.replacePage()
}, 1500); }, 1500);
}else{
showToast(message);
} }
}, },
// 刷新当前页 // 刷新当前页
replacePage() { replacePage() {
uni.redirectTo({ uni.redirectTo({
url: 'pages/mine/warehouse/receiveDetail' url: `pages/mine/warehouse/inventoryDetail?takeId=${this.form.takeId}`
}); });
} }
} }
......
<template> <template>
<!-- 收货详情 --> <!-- 收货详情 -->
<view class="ware-house"> <view class="ware-house">
<u-navbar back-icon-color="#333333" background="#FFFFFF" title="收货" titleColor="#333333" :border-bottom="false" title-bold></u-navbar> <u-navbar back-icon-color="#333333" :background="{ backgroundColor: '#F4F5F7' }" title="收货" titleColor="#333333" :border-bottom="false" title-bold></u-navbar>
<view class="tools-box"> <view class="tools-box">
<text class="tools-box-title">品牌</text> <text class="tools-box-title">品牌</text>
<view class="select-view"> <view class="select-view">
...@@ -38,7 +38,7 @@ import ReceiveQrCode from './components/receiveDetail/receiveQrCode.vue'; ...@@ -38,7 +38,7 @@ import ReceiveQrCode from './components/receiveDetail/receiveQrCode.vue';
import ReceiveBarCode from './components/receiveDetail/receiveBarCode.vue'; import ReceiveBarCode from './components/receiveDetail/receiveBarCode.vue';
import ReceiveImages from './components/receiveDetail/receiveImages.vue'; import ReceiveImages from './components/receiveDetail/receiveImages.vue';
import { receiveStatusOptions } from '@/common/optinos/mine/received.js'; import { receiveStatusOptions } from '@/common/optinos/mine/received.js';
import { showToast } from '@/common/common.js'; import { showToast,setNeedRefresh } from '@/common/common.js';
export default { export default {
components: { components: {
XhPickerSelect, XhPickerSelect,
...@@ -54,7 +54,7 @@ export default { ...@@ -54,7 +54,7 @@ export default {
brandList: [], brandList: [],
disabled: false, disabled: false,
form: { form: {
id: '', // id: '',
brandId: '', brandId: '',
brandName:"", brandName:"",
productCode: '', // 箱码二维码 productCode: '', // 箱码二维码
...@@ -76,7 +76,7 @@ export default { ...@@ -76,7 +76,7 @@ export default {
methods: { methods: {
pickerchange(data) { pickerchange(data) {
this.form.brandId = data.id; this.form.brandId = data.id;
this.form.brandName = data.brandName; this.form.brandName = data.name;
}, },
onScanCodeChange(data) { onScanCodeChange(data) {
this.form.productCode = data; this.form.productCode = data;
...@@ -85,30 +85,36 @@ export default { ...@@ -85,30 +85,36 @@ export default {
this.form.courierNumber = data; this.form.courierNumber = data;
}, },
updateImages(data) { updateImages(data) {
let image = data.map(item => process.uniEnv.qn_asset_url + '/' + item.src + '?imageView2/1/w/100/h/100/q/75'); let image = data.map(item => process.uniEnv.qn_asset_url + '/' + item.src);
this.form.image = image.join(";"); this.form.image = image.join(";");
}, },
// 获取品牌列表 // 获取品牌列表
async getBrandList() { async getBrandList() {
let res = await this.$u.api.brandListByReceivedModules(); let res = await this.$u.api.brandListByReceivedModules();
let { code, data } = res; let { code, data,message } = res;
if (code === 200) { if (code === 200) {
this.brandList = data || []; this.brandList = data || [];
}else{
showToast(message);
} }
}, },
async getDetail() { async getDetail() {
let res = await this.$u.api.receiveDetailByReceivedModules(this.form.id); let res = await this.$u.api.receiveDetailByReceivedModules(this.form.id);
let { code, data } = res; let { code, data,message } = res;
if (code === 200) { if (code === 200) {
let image = data.image.split(';').map(item => { let image = data.image.split(';').map(item => {
return { path: item }; return { path: item };
}); });
this.$refs['receive-images'].initImages(image); this.$refs['receive-images'].initImages(image);
this.form = Object.assign(this.form, data); this.form = Object.assign(this.form, data);
if(!this.form.signId){
showToast('箱码不存在');
}
}else{
showToast(message);
} }
}, },
submit() { submit() {
console.log(this.form)
let { brandId, productCode, courierNumber, image } = this.form; let { brandId, productCode, courierNumber, image } = this.form;
if (!brandId) { if (!brandId) {
showToast('请选择品牌'); showToast('请选择品牌');
...@@ -131,12 +137,15 @@ export default { ...@@ -131,12 +137,15 @@ export default {
}, },
async createdReceive(form) { async createdReceive(form) {
let res=await this.$u.api.addReceiveByReceivedModules(form) let res=await this.$u.api.addReceiveByReceivedModules(form)
let { code, data } = res; let { code, data,message } = res;
if (code === 200) { if (code === 200) {
showToast('操作成功'); showToast('操作成功');
setNeedRefresh()
setTimeout(() => { setTimeout(() => {
this.replacePage() this.replacePage()
}, 1500); }, 1500);
}else{
showToast(message);
} }
}, },
// 刷新当前页 // 刷新当前页
......
...@@ -13,17 +13,17 @@ ...@@ -13,17 +13,17 @@
refresher-enabled="true" refresher-enabled="true"
:refresher-triggered="triggered" :refresher-triggered="triggered"
:refresher-threshold="100" :refresher-threshold="100"
:scroll-top="scrollTop"
refresher-background="#F4F5F7" refresher-background="#F4F5F7"
@refresherrefresh="onRefresh" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @refresherrestore="onRestore"
@scroll="scroll"
enable-back-to-top enable-back-to-top
> >
<NoOrder v-if="noParts" imageName="zwdd.png" :customStyle="noOrderCustomStyle" /> <NoOrder v-if="noParts" imageName="zwdd.png" text="暂无数据" :customStyle="noOrderCustomStyle" />
<template v-else> <template v-else>
<view v-for="(item, index) in list" :key="index"><receiving-info :detail="item" @handleClick="handleClick"></receiving-info></view> <view v-for="(item, index) in list" :key="index"><receiving-info :detail="item" @handleClick="handleClick"></receiving-info></view>
<view class="load-more-view" v-show="(form.pageNumber == 1 && loaded) || form.pageNumber > 1"><u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore></view> <view class="load-more-view" v-show="(form.pageNumber == 1 && loaded) || form.pageNumber > 1">
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</view>
</template> </template>
<view class="loading-view" v-if="!loaded && !freshing"><u-loading mode="flower"></u-loading></view> <view class="loading-view" v-if="!loaded && !freshing"><u-loading mode="flower"></u-loading></view>
</scroll-view> </scroll-view>
...@@ -43,6 +43,7 @@ import ReceivingInfo from './components/received/receivingInfo.vue'; ...@@ -43,6 +43,7 @@ import ReceivingInfo from './components/received/receivingInfo.vue';
import NoOrder from '@/components/order/noOrder.vue'; import NoOrder from '@/components/order/noOrder.vue';
import ApplyButton from '@/components/parts/applyButton.vue'; import ApplyButton from '@/components/parts/applyButton.vue';
import { receiveStatusOptions } from '@/common/optinos/mine/received.js'; import { receiveStatusOptions } from '@/common/optinos/mine/received.js';
import { showToast } from '@/common/common.js';
export default { export default {
components: { components: {
ReceivedHead, ReceivedHead,
...@@ -54,17 +55,12 @@ export default { ...@@ -54,17 +55,12 @@ export default {
data() { data() {
return { return {
receiveStatusOptions, receiveStatusOptions,
list: [ list: [], // 物料订单列表
{ id: 123456, status: "未使用", productCode: 'dsadq4231', brandName: '比亚迪',courierNumber:"SF7720" },
{ id: 1111, status: "未使用", productCode: 'dsadq4231', brandName: '比亚迪' ,courierNumber:"SF7720"},
{ id: 1111, status: "未使用", productCode: 'dsadq4231', brandName: '比亚迪',courierNumber:"SF7720" },
{ id: 1111, status: "未使用", productCode: 'dsadq4231', brandName: '比亚迪',courierNumber:"SF7720" },
], // 物料订单列表
form: { form: {
pageNumber: 0, pageNumber: 0,
pageSize: 10, pageSize: 10,
status: 0, status: 0,
brandId: 982, brandId: ''
}, },
show: false, show: false,
loadStatus: 'loading', // 底部加载状态 loadStatus: 'loading', // 底部加载状态
...@@ -106,7 +102,7 @@ export default { ...@@ -106,7 +102,7 @@ export default {
// this.status = e.index; // this.status = e.index;
// } // }
this.freshing = false; this.freshing = false;
this.getBrandList() // 获取品牌列表 this.getBrandList(); // 获取品牌列表
this.reloadList(); // 加载数据 this.reloadList(); // 加载数据
}, },
onShow() { onShow() {
...@@ -125,12 +121,12 @@ export default { ...@@ -125,12 +121,12 @@ export default {
this.reloadList(); this.reloadList();
}, },
pickerchange(data) { pickerchange(data) {
this.form.brandId = data.id||""; this.form.brandId = data.id || '';
this.reloadList(); this.reloadList();
}, },
// 获取品牌列表 // 获取品牌列表
getBrandList(){ getBrandList() {
this.$refs["received-head"].getBrandList() this.$refs['received-head'].getBrandList();
}, },
// 页面数据:收货列表 // 页面数据:收货列表
async getList() { async getList() {
...@@ -139,18 +135,20 @@ export default { ...@@ -139,18 +135,20 @@ export default {
if (this.form.pageNumber == 1) { if (this.form.pageNumber == 1) {
this.loaded = false; this.loaded = false;
} }
var param = this.form var param = this.form;
let res = await this.$u.api.receiveListByReceivedModules(param); let res = await this.$u.api.receiveListByReceivedModules(param);
if (res.code == 200) { if (res.code == 200) {
if (this.form.pageNumber == 1) { if (this.form.pageNumber == 1) {
this.list = []; this.list = [];
} }
let list = res.data || []; let { list, count } = res.data;
this.list.push(...list); let arr = list || [];
this.loadStatus = list.length < this.pageSize ? 'nomore' : 'loadmore'; // 底部加载状态 this.list.push(...arr);
this.loadStatus = arr.length < this.form.pageSize ? 'nomore' : 'loadmore'; // 底部加载状态
} else { } else {
// this.loadStatus = 'loadmore'; // this.loadStatus = 'loadmore';
console.log(res.message); console.log(res.message);
showToast(res.message);
} }
this.$nextTick(() => { this.$nextTick(() => {
// 页面刷新完之后更新下拉状态 // 页面刷新完之后更新下拉状态
...@@ -221,7 +219,7 @@ export default { ...@@ -221,7 +219,7 @@ export default {
/* 兼容 iOS < 11.2 */ /* 兼容 iOS < 11.2 */
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
/* 兼容 iOS >= 11.2 */ /* 兼容 iOS >= 11.2 */
.tab-view{ .tab-view {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
margin-bottom: 100rpx; margin-bottom: 100rpx;
......
...@@ -45,16 +45,8 @@ ...@@ -45,16 +45,8 @@
:scroll-into-view="itemId" :scroll-into-view="itemId"
> >
<u-form :model="form" ref="uForm"> <u-form :model="form" ref="uForm">
<template <template v-for="(groupItem, groupIndex) in list.length > 0 ? list[tabIndex].items : []">
v-for="(groupItem, groupIndex) in list.length > 0 <view class="class-item" :id="'item' + groupIndex" :key="groupIndex">
? list[tabIndex].items
: []"
>
<view
class="class-item"
:id="'item' + groupIndex"
:key="groupIndex"
>
<view class="title">{{ groupItem.name }}</view> <view class="title">{{ groupItem.name }}</view>
<view class="class-bd"> <view class="class-bd">
<u-form-item <u-form-item
...@@ -63,23 +55,11 @@ ...@@ -63,23 +55,11 @@
label-position="top" label-position="top"
:prop="item.fieldsName" :prop="item.fieldsName"
:border-bottom="false" :border-bottom="false"
v-show=" v-show="checkFields(item.fieldsName) && ((readOnly && !$u.test.isEmpty(form[item.fieldsName])) || !readOnly)"
checkFields(item.fieldsName) &&
((readOnly &&
!$u.test.isEmpty(form[item.fieldsName])) ||
!readOnly)
"
:id="`item${item.fieldsId}`" :id="`item${item.fieldsId}`"
> >
<view <view class="label" v-if="!hiddenTitle.includes(item.formType)">
class="label" <image class="item-image" :src="mixingImage" v-if="item.required"></image>
v-if="!hiddenTitle.includes(item.formType)"
>
<image
class="item-image"
:src="mixingImage"
v-if="item.required"
></image>
{{ item.fieldsTitle }} {{ item.fieldsTitle }}
</view> </view>
<template v-if="item.fieldsType"> <template v-if="item.fieldsType">
...@@ -93,8 +73,7 @@ ...@@ -93,8 +73,7 @@
:disabled="readOnly || item.disabled || false" :disabled="readOnly || item.disabled || false"
:slotContent="item.fieldsInfo" :slotContent="item.fieldsInfo"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-input>
</xh-input>
<xh-multi-input <xh-multi-input
v-if="item.formType === 'multiinput'" v-if="item.formType === 'multiinput'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
...@@ -103,8 +82,7 @@ ...@@ -103,8 +82,7 @@
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
:disabled="readOnly" :disabled="readOnly"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-multi-input>
</xh-multi-input>
<xh-radio <xh-radio
v-if="item.formType === 'radio'" v-if="item.formType === 'radio'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
...@@ -113,8 +91,7 @@ ...@@ -113,8 +91,7 @@
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
:disabled="readOnly || item.disabled || false" :disabled="readOnly || item.disabled || false"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-radio>
</xh-radio>
<xh-checkbox <xh-checkbox
v-if="item.formType === 'checkbox'" v-if="item.formType === 'checkbox'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
...@@ -123,8 +100,7 @@ ...@@ -123,8 +100,7 @@
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
:disabled="readOnly" :disabled="readOnly"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-checkbox>
</xh-checkbox>
<xh-select <xh-select
v-if="item.formType === 'select'" v-if="item.formType === 'select'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
...@@ -133,8 +109,7 @@ ...@@ -133,8 +109,7 @@
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
:disabled="readOnly" :disabled="readOnly"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-select>
</xh-select>
<xh-specifications <xh-specifications
v-if="item.formType === 'select-new-page'" v-if="item.formType === 'select-new-page'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
...@@ -143,8 +118,7 @@ ...@@ -143,8 +118,7 @@
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
:disabled="readOnly" :disabled="readOnly"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-specifications>
</xh-specifications>
<view v-if="item.formType === 'file'"> <view v-if="item.formType === 'file'">
<xh-files <xh-files
:ref="`fileChild${groupIndex}${itemIndex}`" :ref="`fileChild${groupIndex}${itemIndex}`"
...@@ -164,13 +138,7 @@ ...@@ -164,13 +138,7 @@
width="160rpx" width="160rpx"
height="160rpx" height="160rpx"
:border-radius="10" :border-radius="10"
@click=" @click="selectUpload(JSON.stringify(item), groupIndex, itemIndex)"
selectUpload(
JSON.stringify(item),
groupIndex,
itemIndex
)
"
:src="uploadImage" :src="uploadImage"
></u-image> ></u-image>
</view> </view>
...@@ -186,8 +154,7 @@ ...@@ -186,8 +154,7 @@
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
:disabled="readOnly" :disabled="readOnly"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-location>
</xh-location>
<xh-scan <xh-scan
v-if="item.formType === 'scan'" v-if="item.formType === 'scan'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
...@@ -196,8 +163,7 @@ ...@@ -196,8 +163,7 @@
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
:disabled="readOnly" :disabled="readOnly"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-scan>
</xh-scan>
<xh-service-measure <xh-service-measure
v-if="item.formType === 'servicemeasure'" v-if="item.formType === 'servicemeasure'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
...@@ -210,8 +176,7 @@ ...@@ -210,8 +176,7 @@
:value="form[item.fieldsName]" :value="form[item.fieldsName]"
:disabled="readOnly" :disabled="readOnly"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-service-measure>
</xh-service-measure>
<xh-time <xh-time
v-if="item.formType === 'time'" v-if="item.formType === 'time'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
...@@ -220,8 +185,7 @@ ...@@ -220,8 +185,7 @@
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
:disabled="readOnly" :disabled="readOnly"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-time>
</xh-time>
<xh-service-more <xh-service-more
v-if="item.formType === 'form'" v-if="item.formType === 'form'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
...@@ -231,16 +195,14 @@ ...@@ -231,16 +195,14 @@
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
:disabled="readOnly" :disabled="readOnly"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-service-more>
</xh-service-more>
<xh-label <xh-label
v-if="item.formType === 'label'" v-if="item.formType === 'label'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
:itemIndex="itemIndex" :itemIndex="itemIndex"
:item="item" :item="item"
:value="form[item.fieldsName] || ''" :value="form[item.fieldsName] || ''"
> ></xh-label>
</xh-label>
<xh-parts <xh-parts
ref="fileChildParts" ref="fileChildParts"
v-if="item.formType === 'parts'" v-if="item.formType === 'parts'"
...@@ -255,8 +217,7 @@ ...@@ -255,8 +217,7 @@
:disabled="readOnly" :disabled="readOnly"
:maintainStep="list[tabIndex].panelFieldsName" :maintainStep="list[tabIndex].panelFieldsName"
@value-change="fieldValueChange" @value-change="fieldValueChange"
> ></xh-parts>
</xh-parts>
</template> </template>
</u-form-item> </u-form-item>
</view> </view>
...@@ -265,13 +226,7 @@ ...@@ -265,13 +226,7 @@
</u-form> </u-form>
</scroll-view> </scroll-view>
</view> </view>
<view <view :class="['btn-wrap', 'flex-xc', { 'btn-bottom': tabIndex > 0, 'read-only': readOnly }]">
:class="[
'btn-wrap',
'flex-xc',
{ 'btn-bottom': tabIndex > 0, 'read-only': readOnly },
]"
>
<u-button <u-button
class="btn-submit" class="btn-submit"
v-if="!readOnly" v-if="!readOnly"
...@@ -283,59 +238,34 @@ ...@@ -283,59 +238,34 @@
> >
暂存 暂存
</u-button> </u-button>
<u-button <u-button class="btn-submit" @click="nextStep" :custom-style="buttonStyle" type="primary" shape="circle" :hover-class="submitStatus ? '' : 'none'">
class="btn-submit" {{ tabIndex === list.length - 1 ? (readOnly ? '返回列表' : '提交') : readOnly ? '查看下一步' : '下一步' }}
@click="nextStep"
:custom-style="buttonStyle"
type="primary"
shape="circle"
:hover-class="submitStatus ? '' : 'none'"
>
{{
tabIndex === list.length - 1
? readOnly
? '返回列表'
: '提交'
: readOnly
? '查看下一步'
: '下一步'
}}
</u-button> </u-button>
</view> </view>
</view> </view>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
<take-photo <take-photo v-if="takeStatus" @close="closeTake" :upload="false" :currentItem="currentItemDate"></take-photo>
v-if="takeStatus" <u-action-sheet :list="carmeraList" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet>
@close="closeTake"
:upload="false"
:currentItem="currentItemDate"
></take-photo>
<u-action-sheet
:list="carmeraList"
v-model="maskShow"
:cancel-btn="true"
@click="uploadSelect"
></u-action-sheet>
<upload-progress /> <upload-progress />
</view> </view>
</template> </template>
<script> <script>
import XhInput from '@/components/createCom/XhInput.vue' import XhInput from '@/components/createCom/XhInput.vue';
import XhMultiInput from '@/components/createCom/XhMultiInput.vue' import XhMultiInput from '@/components/createCom/XhMultiInput.vue';
import XhRadio from '@/components/createCom/XhRadio.vue' import XhRadio from '@/components/createCom/XhRadio.vue';
import XhCheckbox from '@/components/createCom/XhCheckbox.vue' import XhCheckbox from '@/components/createCom/XhCheckbox.vue';
import XhSelect from '@/components/createCom/XhSelect.vue' import XhSelect from '@/components/createCom/XhSelect.vue';
import XhSpecifications from '@/components/createCom/XhSpecifications.vue' import XhSpecifications from '@/components/createCom/XhSpecifications.vue';
import XhFiles from '@/components/createCom/XhFiles.vue' import XhFiles from '@/components/createCom/XhFiles.vue';
import XhLocation from '@/components/createCom/XhLocation.vue' import XhLocation from '@/components/createCom/XhLocation.vue';
import XhScan from '@/components/createCom/XhScan.vue' import XhScan from '@/components/createCom/XhScan.vue';
import XhTime from '@/components/createCom/XhTime.vue' import XhTime from '@/components/createCom/XhTime.vue';
import XhServiceMeasure from '@/components/createCom/XhServiceMeasure.vue' import XhServiceMeasure from '@/components/createCom/XhServiceMeasure.vue';
import XhServiceMore from '@/components/createCom/XhServiceMore' import XhServiceMore from '@/components/createCom/XhServiceMore';
import XhLabel from '@/components/createCom/XhLabel' import XhLabel from '@/components/createCom/XhLabel';
import XhParts from '@/components/createCom/XhParts' import XhParts from '@/components/createCom/XhParts';
import takePhoto from '@/components/take/index.vue' import takePhoto from '@/components/take/index.vue';
import baseFile from '@/components/upload/index' import baseFile from '@/components/upload/index';
// 表单类型map // 表单类型map
const formType = new Map([ const formType = new Map([
...@@ -363,8 +293,8 @@ const formType = new Map([ ...@@ -363,8 +293,8 @@ const formType = new Map([
['date', ['time', 'text']], ['date', ['time', 'text']],
['form', ['form', 'text']], ['form', ['form', 'text']],
['label', ['label', 'text']], ['label', ['label', 'text']],
['parts', ['parts', 'text']], ['parts', ['parts', 'text']]
]) ]);
/** /**
* modal 弹窗校验 * modal 弹窗校验
...@@ -378,85 +308,83 @@ const actions = (name, pass, type, submit) => { ...@@ -378,85 +308,83 @@ const actions = (name, pass, type, submit) => {
const handerProgrom = { const handerProgrom = {
perfect: { perfect: {
confirmText: '去完善', confirmText: '去完善',
action: 'handerProgrom', action: 'handerProgrom'
}, },
appointment: { appointment: {
confirmText: '好的,再次预约', confirmText: '好的,再次预约',
action: 'appointment', action: 'appointment'
}, },
next: { next: {
confirmText: '下一步', confirmText: '下一步',
action: 'nextAction', action: 'nextAction'
}, },
noPerfectSubmit: { noPerfectSubmit: {
confirmText: '去完善', confirmText: '去完善',
action: 'handerProgrom', action: 'handerProgrom',
cancelText: '部分提交', cancelText: '部分提交',
cancelAction: 'appointment', cancelAction: 'appointment'
}, },
submit: { submit: {
confirmText: '提交', confirmText: '提交',
action: 'orderFinish', action: 'orderFinish'
}, },
confirm: { confirm: {
confirmText: '确定', confirmText: '确定',
action: 'nextAction', action: 'nextAction',
cancelText: '取消', cancelText: '取消',
cancelAction: 'closeResult', cancelAction: 'closeResult'
},
} }
};
if (name === 'partnerInspectItem') { if (name === 'partnerInspectItem') {
// 勘察 // 勘察
if (!pass) return handerProgrom.perfect if (!pass) return handerProgrom.perfect;
return type return type ? (type === '01' ? handerProgrom.next : handerProgrom.appointment) : handerProgrom.perfect;
? type === '01'
? handerProgrom.next
: handerProgrom.appointment
: handerProgrom.perfect
} else if (name === 'partnerInstallItem') { } else if (name === 'partnerInstallItem') {
// 安装 // 安装
let hander = '' let hander = '';
switch (type) { switch (type) {
case '01': // 安装完成 case '01': // 安装完成
hander = !pass ? handerProgrom.perfect : handerProgrom.next hander = !pass ? handerProgrom.perfect : handerProgrom.next;
break break;
case '02': // 二次安装 case '02': // 二次安装
hander = !pass hander = !pass ? handerProgrom.noPerfectSubmit : handerProgrom.appointment;
? handerProgrom.noPerfectSubmit break;
: handerProgrom.appointment
break
case '03': //不安装 case '03': //不安装
hander = handerProgrom.confirm hander = handerProgrom.confirm;
break break;
default: default:
hander = handerProgrom.perfect hander = handerProgrom.perfect;
break break;
} }
return hander return hander;
} else { } else {
// 基础信息 // 基础信息
if (!pass) return handerProgrom.perfect if (!pass) return handerProgrom.perfect;
return submit ? handerProgrom.submit : handerProgrom.next return submit ? handerProgrom.submit : handerProgrom.next;
} }
} };
const fields = { const fields = {
'paymentMethodsType': { // 基本信息-不需要收款 paymentMethodsType: {
// 基本信息-不需要收款
fieldsName: ['actualPaid', 'eSerialNum'], fieldsName: ['actualPaid', 'eSerialNum'],
value: '03' value: '03'
}, },
'usePart': { // 维修工单-是否使用配件 usePart: {
// 维修工单-是否使用配件
fieldsName: ['partName'], fieldsName: ['partName'],
value: '02' value: '02'
}, },
'getMoney': { // 维修工单-是否收款 getMoney: {
// 维修工单-是否收款
fieldsName: ['feeValue', 'feeProject'], fieldsName: ['feeValue', 'feeProject'],
value: '02' value: '02'
} }
} };
const fieldsNameArr = Object.values(fields).map(v => v.fieldsName).reduce((acc, cur) => [...acc, ...cur], []) const fieldsNameArr = Object.values(fields)
.map(v => v.fieldsName)
.reduce((acc, cur) => [...acc, ...cur], []);
export default { export default {
data() { data() {
...@@ -491,7 +419,7 @@ export default { ...@@ -491,7 +419,7 @@ export default {
confirmText: '去完善', confirmText: '去完善',
cancelText: '', cancelText: '',
action: '', action: '',
cancelAction: '', cancelAction: ''
}, },
waitHandlerPanelIndex: 0, waitHandlerPanelIndex: 0,
waitHandlerGroupIndex: 0, waitHandlerGroupIndex: 0,
...@@ -500,20 +428,20 @@ export default { ...@@ -500,20 +428,20 @@ export default {
// 上传组件相关 // 上传组件相关
carmeraList: [ carmeraList: [
{ {
text: '相册', text: '相册'
}, },
{ {
text: '拍照', text: '拍照'
}, }
], ],
maskShow: false, maskShow: false,
takeStatus: false, takeStatus: false,
currentItemDate: {}, currentItemDate: {},
photoItem: {}, photoItem: {},
maintainStep: 'partnerInspectItem', maintainStep: 'partnerInspectItem',
orderStatus: '', orderStatus: ''
// showTab: true, // showTab: true,
} };
}, },
components: { components: {
XhInput, XhInput,
...@@ -530,51 +458,44 @@ export default { ...@@ -530,51 +458,44 @@ export default {
XhServiceMore, XhServiceMore,
XhLabel, XhLabel,
XhParts, XhParts,
'take-photo': takePhoto, 'take-photo': takePhoto
}, },
mixins: [baseFile], mixins: [baseFile],
onLoad(option) { onLoad(option) {
getApp().trackPage('订单完工信息页') getApp().trackPage('订单完工信息页');
if (option) { if (option) {
this.orderNumber = option.orderNumber this.orderNumber = option.orderNumber;
this.maintainStep = option.maintainStep this.maintainStep = option.maintainStep;
this.orderId = option.orderId this.orderId = option.orderId;
this.categoryId = option.categoryId this.categoryId = option.categoryId;
this.brandId = option.brandId this.brandId = option.brandId;
this.orderServiceType = decodeURIComponent(option.orderServiceType) this.orderServiceType = decodeURIComponent(option.orderServiceType);
this.inGuaranteePeriod = option.inGuaranteePeriod this.inGuaranteePeriod = option.inGuaranteePeriod;
this.partnerCompanyId = option.partnerCompanyId this.partnerCompanyId = option.partnerCompanyId;
this.orderStatus = option.orderStatus this.orderStatus = option.orderStatus;
this.auditResults = option?.auditResults this.auditResults = option?.auditResults ? option?.auditResults.split(',') : [];
? option?.auditResults.split(',') }
: [] this.getCompleteData();
}
this.getCompleteData()
}, },
updated() { updated() {
//console.log(this.form.name, 'form.name') //console.log(this.form.name, 'form.name')
}, },
computed: { computed: {
exception() { exception() {
return this.orderStatus == '86' return this.orderStatus == '86';
}, },
readOnly() { readOnly() {
return ( return [80, 81, 83, 85, 87, 89, 88, 110].indexOf(Number(this.orderStatus)) != -1;
[80, 81, 83, 85, 87, 89, 88, 110].indexOf(Number(this.orderStatus)) !=
-1
)
}, },
tabList() { tabList() {
// 没有数据的时候tab要有占位数据,不然有页面有晃动 // 没有数据的时候tab要有占位数据,不然有页面有晃动
return this.list.length > 0 return this.list.length > 0 ? this.list[this.tabIndex].items : [{ name: '' }];
? this.list[this.tabIndex].items
: [{ name: '' }]
}, },
mixingImage() { mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png' return process.uniEnv.qn_base_url + 'mixing.png';
}, },
uploadImage() { uploadImage() {
return process.uniEnv.qn_base_url + 'upload-file.png' return process.uniEnv.qn_base_url + 'upload-file.png';
}, },
buttonStyle() { buttonStyle() {
return { return {
...@@ -584,8 +505,8 @@ export default { ...@@ -584,8 +505,8 @@ export default {
height: '104rpx', height: '104rpx',
'font-size': '32rpx', 'font-size': '32rpx',
'font-weight': 'bold', 'font-weight': 'bold',
'margin-left': '50rpx', 'margin-left': '50rpx'
} };
}, },
customStyle() { customStyle() {
return { return {
...@@ -596,96 +517,90 @@ export default { ...@@ -596,96 +517,90 @@ export default {
border: '1px solid #2272FF', border: '1px solid #2272FF',
color: '#2272FF', color: '#2272FF',
'font-weight': 'bold', 'font-weight': 'bold',
'font-size': '32rpx', 'font-size': '32rpx'
} };
}, },
show200() { show200() {
return ( return this.form.paymentMethodsType && this.form.paymentMethodsType != '03';
this.form.paymentMethodsType && this.form.paymentMethodsType != '03'
)
}, },
// 从订单管理和浏览记录进来,不跳转到订单列表,而是后退到订单管理和浏览记录 // 从订单管理和浏览记录进来,不跳转到订单列表,而是后退到订单管理和浏览记录
completeBack() { completeBack() {
let pages = getCurrentPages() let pages = getCurrentPages();
var i = 0 var i = 0;
for (var item of pages) { for (var item of pages) {
if ( if (['/pages/mine/history/index', '/pages/mine/order/index'].indexOf(item.$page?.fullPath.split('?')[0]) != -1) {
['/pages/mine/history/index', '/pages/mine/order/index'].indexOf( return pages.length - i - 1;
item.$page?.fullPath.split('?')[0]
) != -1
) {
return pages.length - i - 1
} }
i++ i++;
}
return 0;
} }
return 0
},
}, },
methods: { methods: {
checkFields(name) { checkFields(name) {
let status = true let status = true;
if (fieldsNameArr.includes(name)) { if (fieldsNameArr.includes(name)) {
Object.entries(fields).forEach(v => { Object.entries(fields).forEach(v => {
if (v[1].fieldsName.includes(name)) { if (v[1].fieldsName.includes(name)) {
status = this.form[v[0]] ? this.form[v[0]] !== v[1].value : false status = this.form[v[0]] ? this.form[v[0]] !== v[1].value : false;
} }
}) });
} }
return status return status;
}, },
getCompleteData() { getCompleteData() {
//获取工单配置的完工项目 //获取工单配置的完工项目
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中'
}) });
if (this.orderId) { if (this.orderId) {
this.$u.api.getCompleteConfigAndData(this.orderId).then((res) => { this.$u.api.getCompleteConfigAndData(this.orderId).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.initData(res) this.initData(res);
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.message || res.data, title: res.message || res.data,
type: 'error', type: 'error'
}) });
} }
}) });
} }
}, },
initData(res) { initData(res) {
this.form = res.data.value || {} this.form = res.data.value || {};
this.loadOrderDetail() this.loadOrderDetail();
const data = Object.create(res.data.config, {}) const data = Object.create(res.data.config, {});
const list = data.sort((a, b) => a.order - b.order) const list = data.sort((a, b) => a.order - b.order);
if (this.readOnly) this.tabIndex = 0 if (this.readOnly) this.tabIndex = 0;
list.forEach((item, index) => { list.forEach((item, index) => {
if (this.maintainStep === item.panelFieldsName && !this.readOnly) { if (this.maintainStep === item.panelFieldsName && !this.readOnly) {
this.tabIndex = index this.tabIndex = index;
} }
item.items.forEach((v) => { item.items.forEach(v => {
v.items.forEach((d) => { v.items.forEach(d => {
const type = d.fieldsType.toLocaleLowerCase() const type = d.fieldsType.toLocaleLowerCase();
const formMap = formType.get(type) || formType.get('text') const formMap = formType.get(type) || formType.get('text');
d.formType = formMap[0] d.formType = formMap[0];
d.inputType = formMap[1] d.inputType = formMap[1];
if (fieldsNameArr.includes(d.fieldsName)) { if (fieldsNameArr.includes(d.fieldsName)) {
d.required = this.checkFields(d.fieldsName) d.required = this.checkFields(d.fieldsName);
} }
if (d.fieldsName === 'pipe' || d.fieldsName === 'pipeUseLength') { if (d.fieldsName === 'pipe' || d.fieldsName === 'pipeUseLength') {
// 申请费用计算 // 申请费用计算
this.calcMoney() this.calcMoney();
} }
if (d.fieldsName === 'materialList') { if (d.fieldsName === 'materialList') {
d.subtitle = '(必填项)' d.subtitle = '(必填项)';
} }
if (d.fieldsName === 'craftList') { if (d.fieldsName === 'craftList') {
d.subtitle = '(若有增项,则为必填项)' d.subtitle = '(若有增项,则为必填项)';
} }
}) });
}) });
}) });
// this.showTab = this.list.length > 1 // this.showTab = this.list.length > 1
// 异常单处理 // 异常单处理
...@@ -694,37 +609,29 @@ export default { ...@@ -694,37 +609,29 @@ export default {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '未找到不通过项', title: '未找到不通过项',
type: 'error', type: 'error',
back: true, back: true
}) });
} }
this.checkCompleteError(list) this.checkCompleteError(list);
} else { } else {
this.list = Object.freeze(list) this.list = Object.freeze(list);
} }
uni.hideLoading() uni.hideLoading();
}, },
loadOrderDetail() { loadOrderDetail() {
if ( if (!this.$u.test.isEmpty(this.form) && this.form.hasOwnProperty('installComfirmTime') && this.$u.test.isEmpty(this.form.installComfirmTime)) {
!this.$u.test.isEmpty(this.form) && this.$u.api.orderDetail(null, this.orderId).then(res => {
this.form.hasOwnProperty('installComfirmTime') &&
this.$u.test.isEmpty(this.form.installComfirmTime)
) {
this.$u.api.orderDetail(null, this.orderId).then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (!this.$u.test.isEmpty(res.data.checkInDateTime)) { if (!this.$u.test.isEmpty(res.data.checkInDateTime)) {
this.$set( this.$set(this.form, 'installComfirmTime', this.moment(res.data.checkInDateTime).format('YYYY-MM-DD'));
this.form,
'installComfirmTime',
this.moment(res.data.checkInDateTime).format('YYYY-MM-DD')
)
} }
} }
}) });
} }
}, },
checkCompleteError(list) { checkCompleteError(list) {
// 异常单定位错误项 // 异常单定位错误项
let errArr = [] let errArr = [];
list.forEach((panel, panelIndex) => { list.forEach((panel, panelIndex) => {
panel.items.forEach((group, groupIndex) => { panel.items.forEach((group, groupIndex) => {
group.items.forEach((ele, eleIndex) => { group.items.forEach((ele, eleIndex) => {
...@@ -732,63 +639,59 @@ export default { ...@@ -732,63 +639,59 @@ export default {
const errGroup = { const errGroup = {
componentType: group.componentType, componentType: group.componentType,
name: group.name, name: group.name,
items: ele, items: ele
} };
if (ele.fieldsName === 'orderSpareParts') { if (ele.fieldsName === 'orderSpareParts') {
const index = errArr.findIndex(v => v.name === '备件信息' || v.name === '物料信息') const index = errArr.findIndex(v => v.name === '备件信息' || v.name === '物料信息');
if (index > -1) return if (index > -1) return;
} }
errArr.push(errGroup) errArr.push(errGroup);
} }
}) });
}) });
}) });
// 图片分组 // 图片分组
const result = errArr.reduce((groups, item) => { const result = errArr.reduce((groups, item) => {
let groupFound = groups.find((arrItem) => item.name === arrItem.name) let groupFound = groups.find(arrItem => item.name === arrItem.name);
if (groupFound) { if (groupFound) {
groupFound.componentType = item.componentType groupFound.componentType = item.componentType;
if (groupFound.items.indexOf(item.items) == -1) { if (groupFound.items.indexOf(item.items) == -1) {
//去重 //去重
groupFound.items.push(item.items) groupFound.items.push(item.items);
} }
} else { } else {
//不要直接在原来的对象修改,新建对象 //不要直接在原来的对象修改,新建对象
let newGroup = { let newGroup = {
name: item.name, name: item.name,
componentType: item.componentType, componentType: item.componentType,
items: [item.items], items: [item.items]
} };
groups.push(newGroup) groups.push(newGroup);
} }
return groups return groups;
}, []) }, []);
let index = list.length++ let index = list.length++;
list[index] = { list[index] = {
order: index + 1, order: index + 1,
panelFieldsName: 'error', panelFieldsName: 'error',
panelName: '异常处理', panelName: '异常处理',
items: result, items: result
} };
this.list = Object.freeze(list) this.list = Object.freeze(list);
this.tabIndex = index this.tabIndex = index;
}, },
handleSaveData() { handleSaveData() {
let param = {} let param = {};
const name = this.list[this.tabIndex].panelFieldsName const name = this.list[this.tabIndex].panelFieldsName;
this.list.forEach((panel) => { this.list.forEach(panel => {
param[panel.panelFieldsName] = [] param[panel.panelFieldsName] = [];
panel.items.forEach((group) => { panel.items.forEach(group => {
group.items.forEach((ele) => { group.items.forEach(ele => {
if (name === 'partnerInspectItem') { if (name === 'partnerInspectItem') {
if (!this.form?.installationMethodType) { if (!this.form?.installationMethodType) {
this.$set( this.$set(this.form, 'installationMethodType', this.form.installType);
this.form,
'installationMethodType',
this.form.installType
)
} }
} }
if (this.form[ele.fieldsName]) { if (this.form[ele.fieldsName]) {
...@@ -796,147 +699,148 @@ export default { ...@@ -796,147 +699,148 @@ export default {
fieldsName: ele.fieldsName, fieldsName: ele.fieldsName,
fieldsType: ele.fieldsType, fieldsType: ele.fieldsType,
fieldsValue: this.form[ele.fieldsName], fieldsValue: this.form[ele.fieldsName],
required: ele.required, required: ele.required
}) });
} }
}) });
}) });
}) });
return param return param;
}, },
saveComplete() { saveComplete() {
// 保存完工信息 // 保存完工信息
// this.submitParts() // 不调这个接口;没完工不能调提交配件 // this.submitParts() // 不调这个接口;没完工不能调提交配件
const param = this.handleSaveData() const param = this.handleSaveData();
this.$u.api.saveCompleteData(param, this.orderId).then((res) => { this.$u.api.saveCompleteData(param, this.orderId).then(res => {
if (res.code == 200) { let { code, data, message } = res;
if (code == 200) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '保存成功', title: '保存成功',
type: 'success', type: 'success'
}) });
} else { } else {
let msg = '';
if (data && data instanceof string) {
msg = data;
} else {
msg = message;
}
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data || res.message, title: msg,
type: 'error', type: 'error'
}) });
} }
}) });
}, },
checkCompleteItem() { checkCompleteItem() {
let checkResult = [] let checkResult = [];
let pass = true let pass = true;
let first = true let first = true;
const lists = this.tabList const lists = this.tabList;
console.log("lists", lists) console.log('lists', lists);
lists.forEach((group, groupIndex) => { lists.forEach((group, groupIndex) => {
const checkRequired = group.items.some((v) => v.required) const checkRequired = group.items.some(v => v.required);
if (checkRequired) { if (checkRequired) {
let panelResult = { let panelResult = {
label: group.name, label: group.name,
submitted: 0, submitted: 0,
required: 0, required: 0,
pass: true, pass: true
} };
group.items.forEach((ele, eleIndex) => { group.items.forEach((ele, eleIndex) => {
if (ele.fieldsType == 'PARTS') { if (ele.fieldsType == 'PARTS') {
console.log("ele", ele) console.log('ele', ele);
} }
if (ele.required) { if (ele.required) {
panelResult.required++ panelResult.required++;
let value = this.form[ele.fieldsName] let value = this.form[ele.fieldsName];
// "ele.fieldsName != 'eSerialNum' || value.length == 8" 意思是: "非付款流水号 || 8位付款流水号" // "ele.fieldsName != 'eSerialNum' || value.length == 8" 意思是: "非付款流水号 || 8位付款流水号"
if (value && !Array.isArray(value) && (ele.fieldsName != 'eSerialNum' || value.length == 8)) { if (value && !Array.isArray(value) && (ele.fieldsName != 'eSerialNum' || value.length == 8)) {
panelResult.submitted++ panelResult.submitted++;
} else if (value && Array.isArray(value) && value.length > 0) { } else if (value && Array.isArray(value) && value.length > 0) {
if (ele.fieldsName === 'materialList') { if (ele.fieldsName === 'materialList') {
let hasMate = false let hasMate = false;
let mateRow = value.find((mate) => { let mateRow = value.find(mate => {
if (mate.hasOwnProperty('useLength')) { if (mate.hasOwnProperty('useLength')) {
hasMate = true hasMate = true;
return !this.$u.test.isEmpty(mate.useLength) return !this.$u.test.isEmpty(mate.useLength);
} }
}) });
if (!hasMate || !this.$u.test.isEmpty(mateRow)) { if (!hasMate || !this.$u.test.isEmpty(mateRow)) {
panelResult.submitted++ panelResult.submitted++;
} }
} else { } else {
panelResult.submitted++ panelResult.submitted++;
} }
} else if (first) { } else if (first) {
// 记录第一个 为空 并且需要必填的项 用于定位 // 记录第一个 为空 并且需要必填的项 用于定位
first = false first = false;
this.waitHandlerPanelIndex = this.tabIndex this.waitHandlerPanelIndex = this.tabIndex;
this.waitHandlerGroupIndex = groupIndex this.waitHandlerGroupIndex = groupIndex;
this.waitHandlerEleIndex = eleIndex this.waitHandlerEleIndex = eleIndex;
this.oldItemId = `item${ele.fieldsId}` this.oldItemId = `item${ele.fieldsId}`;
} }
} }
}) });
panelResult.pass = panelResult.required <= panelResult.submitted panelResult.pass = panelResult.required <= panelResult.submitted;
pass = pass && panelResult.pass pass = pass && panelResult.pass;
checkResult.push(panelResult) checkResult.push(panelResult);
} }
}) });
this.completeCheck.result = checkResult
return pass
},
closeResult() {
this.completeCheck.result = checkResult;
return pass;
}, },
closeResult() {},
// 检查结果窗口取消回调 // 检查结果窗口取消回调
closeCheckResult() { closeCheckResult() {
this.completeCheck.status = false this.completeCheck.status = false;
this[this.completeCheck.cancelAction]() this[this.completeCheck.cancelAction]();
}, },
// 检查结果窗口 确认回调 // 检查结果窗口 确认回调
confirm() { confirm() {
this.completeCheck.status = false this.completeCheck.status = false;
this[this.completeCheck.action]() this[this.completeCheck.action]();
}, },
// 去完善 // 去完善
handerProgrom() { handerProgrom() {
this.locationCompleteItem( this.locationCompleteItem(this.waitHandlerPanelIndex, this.waitHandlerGroupIndex, this.waitHandlerEleIndex);
this.waitHandlerPanelIndex,
this.waitHandlerGroupIndex,
this.waitHandlerEleIndex
)
}, },
// 去预约 // 去预约
async appointment() { async appointment() {
const save = await this.nextStepSaveData() const save = await this.nextStepSaveData();
if (save) { if (save) {
if (this.completeBack) { if (this.completeBack) {
// 从订单管理和浏览记录进来 // 从订单管理和浏览记录进来
uni.navigateBack({ uni.navigateBack({
delta: this.completeBack, delta: this.completeBack
}) });
} else { } else {
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/order?type=waitAppointment', url: '/pages/index/order?type=waitAppointment'
}) });
} }
} }
}, },
// 下一步动作 // 下一步动作
async nextAction() { async nextAction() {
const save = await this.nextStepSaveData() const save = await this.nextStepSaveData();
if (save) { if (save) {
this.nextTab() this.nextTab();
} }
}, },
nextTab() { nextTab() {
if (this.tabIndex < this.list.length - 1) { if (this.tabIndex < this.list.length - 1) {
this.tabIndex++ this.tabIndex++;
this.arr = [] this.arr = [];
this.scrollRightTop = 0 this.scrollRightTop = 0;
this.current = 0 this.current = 0;
//this.itemId = '' //this.itemId = ''
//const itemId = this.list[this.tabIndex].items[0].items[0].fieldsId //const itemId = this.list[this.tabIndex].items[0].items[0].fieldsId
//this.oldItemId = `item${itemId}` //this.oldItemId = `item${itemId}`
this.$nextTick(async () => { this.$nextTick(async () => {
await this.swichMenu(0) await this.swichMenu(0);
}) });
} }
}, },
...@@ -944,27 +848,24 @@ export default { ...@@ -944,27 +848,24 @@ export default {
nextStep() { nextStep() {
if (this.readOnly) { if (this.readOnly) {
if (this.tabIndex === this.list.length - 1) { if (this.tabIndex === this.list.length - 1) {
uni.navigateBack() uni.navigateBack();
} else { } else {
this.nextTab() this.nextTab();
} }
return return;
} }
this.pass = this.checkCompleteItem() this.pass = this.checkCompleteItem();
const name = this.list[this.tabIndex].panelFieldsName const name = this.list[this.tabIndex].panelFieldsName;
const type = const type = name === 'partnerInspectItem' ? this.form.inspectConclusionType : this.form.constructionConclusionType;
name === 'partnerInspectItem' const submit = this.tabIndex === this.list.length - 1;
? this.form.inspectConclusionType const result = actions(name, this.pass, type, submit);
: this.form.constructionConclusionType
const submit = this.tabIndex === this.list.length - 1
const result = actions(name, this.pass, type, submit)
this.completeCheck.status = true this.completeCheck.status = true;
this.completeCheck.confirmText = result.confirmText this.completeCheck.confirmText = result.confirmText;
this.completeCheck.action = result.action this.completeCheck.action = result.action;
this.completeCheck.cancelText = result.cancelText || '' this.completeCheck.cancelText = result.cancelText || '';
this.completeCheck.cancelAction = result.cancelAction || '' this.completeCheck.cancelAction = result.cancelAction || '';
}, },
// 下一步数据保存 // 下一步数据保存
nextStepSaveData() { nextStepSaveData() {
...@@ -972,69 +873,69 @@ export default { ...@@ -972,69 +873,69 @@ export default {
maintainFields: this.handleSaveData(), maintainFields: this.handleSaveData(),
currentStep: this.list[this.tabIndex].panelFieldsName, currentStep: this.list[this.tabIndex].panelFieldsName,
nextStep: this.list[this.tabIndex + 1].panelFieldsName, nextStep: this.list[this.tabIndex + 1].panelFieldsName,
version: 2, version: 2
} };
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中'
}) });
return this.$u.api.completeNextStep(params, this.orderId).then((res) => { return this.$u.api.completeNextStep(params, this.orderId).then(res => {
uni.hideLoading() uni.hideLoading();
if (res.code == 200) { if (res.code == 200) {
return Promise.resolve(true) return Promise.resolve(true);
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.message || res.data, title: res.message || res.data,
type: 'error', type: 'error'
}) });
return Promise.resolve(false) return Promise.resolve(false);
} }
}) });
}, },
locationCompleteItem(panelIndex, groupIndex, eleIndex) { locationCompleteItem(panelIndex, groupIndex, eleIndex) {
// 页面定位到某一项 // 页面定位到某一项
this.tabIndex = panelIndex this.tabIndex = panelIndex;
this.current = groupIndex this.current = groupIndex;
this.itemId = '' this.itemId = '';
this.$nextTick(function() { this.$nextTick(function() {
if (this.oldItemId) this.itemId = this.oldItemId if (this.oldItemId) this.itemId = this.oldItemId;
}) });
}, },
// 提交配件信息 // 提交配件信息
submitParts() { submitParts() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.form.orderSpareParts) { if (this.form.orderSpareParts) {
const orderSpareParts = JSON.parse(this.form.orderSpareParts) const orderSpareParts = JSON.parse(this.form.orderSpareParts);
const lists = orderSpareParts.filter((v) => v.quantity > 0) const lists = orderSpareParts.filter(v => v.quantity > 0);
const params = { const params = {
workOrderId: this.orderId, workOrderId: this.orderId,
applyType: '10', applyType: '10',
parts: lists ? JSON.stringify(lists) : '', parts: lists ? JSON.stringify(lists) : ''
} };
this.$u.api.createParts(params).then((res) => { this.$u.api.createParts(params).then(res => {
if (res.code !== 200) { if (res.code !== 200) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data, title: res.data,
type: 'error', type: 'error'
}) });
resolve(false) resolve(false);
} }
resolve(true) resolve(true);
}) });
} else { } else {
resolve(true) resolve(true);
} }
}) });
}, },
// 提交订单 // 提交订单
orderFinish() { orderFinish() {
const param = this.handleSaveData() const param = this.handleSaveData();
// 完工事件埋点 // 完工事件埋点
getApp().track('order_finish', { getApp().track('order_finish', {
id: this.vuex_user.id, id: this.vuex_user.id,
mobile: this.vuex_user.mobile, mobile: this.vuex_user.mobile,
orderId: Number(this.orderId), orderId: Number(this.orderId)
}) });
this.$u.api.saveCompleteData(param, this.orderId).then(async (res) => { this.$u.api.saveCompleteData(param, this.orderId).then(async res => {
if (res.code == 200) { if (res.code == 200) {
//完工项信息保存成功再次完工工单 //完工项信息保存成功再次完工工单
// if (!this.exception) { // 核销配件 // if (!this.exception) { // 核销配件
...@@ -1043,37 +944,35 @@ export default { ...@@ -1043,37 +944,35 @@ export default {
// } // }
if (this.inGuaranteePeriod === 'Y') { if (this.inGuaranteePeriod === 'Y') {
this.$u.api.inOrderFinish(this.orderId).then((res) => { this.$u.api.inOrderFinish(this.orderId).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.successTips() this.successTips();
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data, title: res.data,
type: 'error', type: 'error'
}) });
} }
}) });
} else { } else {
this.$u.api this.$u.api.outOrderFinish({ customerPayType: 'CASH' }, this.orderId).then(res => {
.outOrderFinish({ customerPayType: 'CASH' }, this.orderId)
.then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.successTips() this.successTips();
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data, title: res.data,
type: 'error', type: 'error'
}) });
} }
}) });
} }
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.message, title: res.message,
type: 'error', type: 'error'
}) });
} }
}) });
}, },
// 提交成功后续 // 提交成功后续
successTips() { successTips() {
...@@ -1085,70 +984,67 @@ export default { ...@@ -1085,70 +984,67 @@ export default {
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
uni.reLaunch({ uni.reLaunch({
url: `/pages/order/quality?id=${this.orderId}`, url: `/pages/order/quality?id=${this.orderId}`
}) });
} else if (res.cancel) { } else if (res.cancel) {
if (this.completeBack) { if (this.completeBack) {
// 从订单管理和浏览记录进来 // 从订单管理和浏览记录进来
uni.navigateBack({ uni.navigateBack({
delta: this.completeBack, delta: this.completeBack
}) });
} else { } else {
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/order?type=audit', url: '/pages/index/order?type=audit'
}) });
} }
} }
} }
}) });
}, },
calMaterialCraftListAmount(arr) { calMaterialCraftListAmount(arr) {
let amount = 0 let amount = 0;
if (arr) { if (arr) {
arr.forEach((item) => { arr.forEach(item => {
let useLength = let useLength = (item.hasOwnProperty('useLength') && Number(item.useLength)) || 0;
(item.hasOwnProperty('useLength') && Number(item.useLength)) || 0 let freeLength = (item.hasOwnProperty('freeLength') && Number(item.freeLength)) || 0;
let freeLength = let unitAmt = (item.hasOwnProperty('unitAmt') && Number(item.unitAmt)) || 0;
(item.hasOwnProperty('freeLength') && Number(item.freeLength)) || 0 amount += Math.max(useLength - freeLength, 0) * unitAmt;
let unitAmt =
(item.hasOwnProperty('unitAmt') && Number(item.unitAmt)) || 0
amount += Math.max(useLength - freeLength, 0) * unitAmt
if (item.hasOwnProperty('extraAmt') && Number(item.extraAmt)) { if (item.hasOwnProperty('extraAmt') && Number(item.extraAmt)) {
amount += Number(item.extraAmt) amount += Number(item.extraAmt);
} }
}) });
} }
return amount return amount;
}, },
setData(data) { setData(data) {
// 通过页面设置数据 // 通过页面设置数据
Object.keys(data).forEach((key) => { Object.keys(data).forEach(key => {
this.$set(this.form, key, data[key]) this.$set(this.form, key, data[key]);
}) });
// 更新预计超出金额 // 更新预计超出金额
let amount = 0 let amount = 0;
amount += this.calMaterialCraftListAmount(this.form.materialList) amount += this.calMaterialCraftListAmount(this.form.materialList);
amount += this.calMaterialCraftListAmount(this.form.craftList) amount += this.calMaterialCraftListAmount(this.form.craftList);
this.$set(this.form, 'overAmount', amount || 0) this.$set(this.form, 'overAmount', amount || 0);
}, },
// 字段的值更新 // 字段的值更新
fieldValueChange(data) { fieldValueChange(data) {
const groupItem = this.list[this.tabIndex].items[data.groupIndex] const groupItem = this.list[this.tabIndex].items[data.groupIndex];
let innerItem let innerItem;
if (groupItem.items) { if (groupItem.items) {
innerItem = groupItem.items[data.itemIndex] innerItem = groupItem.items[data.itemIndex];
} }
if (innerItem.fieldsType === 'multiInput') { if (innerItem.fieldsType === 'multiInput') {
// 多个输入框的值触发 // 多个输入框的值触发
let key = Object.keys(data.value)[0] let key = Object.keys(data.value)[0];
this.form[key] = data.value[key] this.form[key] = data.value[key];
} else { } else {
if (innerItem.fieldsName === 'orderSpareParts' && data.value === '[]') { if (innerItem.fieldsName === 'orderSpareParts' && data.value === '[]') {
this.$set(this.form, innerItem.fieldsName, '') this.$set(this.form, innerItem.fieldsName, '');
} else { } else {
this.$set(this.form, innerItem.fieldsName, data.value) this.$set(this.form, innerItem.fieldsName, data.value);
} }
} }
...@@ -1156,56 +1052,52 @@ export default { ...@@ -1156,56 +1052,52 @@ export default {
if (fields[innerItem.fieldsName]) { if (fields[innerItem.fieldsName]) {
groupItem.items.forEach(c => { groupItem.items.forEach(c => {
if (fields[innerItem.fieldsName]['fieldsName'].includes(c.fieldsName)) { if (fields[innerItem.fieldsName]['fieldsName'].includes(c.fieldsName)) {
c.required = data.value !== fields[innerItem.fieldsName]['value'] c.required = data.value !== fields[innerItem.fieldsName]['value'];
} }
}) });
} }
if ( if (innerItem.fieldsName === 'pipe' || innerItem.fieldsName === 'pipeUseLength') {
innerItem.fieldsName === 'pipe' ||
innerItem.fieldsName === 'pipeUseLength'
) {
// 申请费用计算 // 申请费用计算
this.calcMoney() this.calcMoney();
} }
// console.log("this.form", this.form) // console.log("this.form", this.form)
}, },
// 申请费用计算 // 申请费用计算
calcMoney() { calcMoney() {
const price = parseInt(this.form.pipe) || 0 const price = parseInt(this.form.pipe) || 0;
const pipeUseLength = parseFloat(this.form.pipeUseLength) || 0 const pipeUseLength = parseFloat(this.form.pipeUseLength) || 0;
if (price && pipeUseLength) { if (price && pipeUseLength) {
const money = (price * pipeUseLength).toFixed(2) const money = (price * pipeUseLength).toFixed(2);
this.$set(this.form, 'pipeAmount', money) this.$set(this.form, 'pipeAmount', money);
} else { } else {
this.$set(this.form, 'pipeAmount', 0) this.$set(this.form, 'pipeAmount', 0);
} }
}, },
// ------------------------- 以下方法为上传组件相关 ------------------------- // ------------------------- 以下方法为上传组件相关 -------------------------
// 弹出上传选项 // 弹出上传选项
selectUpload(item, groupIndex, itemIndex) { selectUpload(item, groupIndex, itemIndex) {
const imgList = this.$refs[`fileChild${groupIndex}${itemIndex}`][0] const imgList = this.$refs[`fileChild${groupIndex}${itemIndex}`][0].imgList;
.imgList
if (imgList.length === 10) { if (imgList.length === 10) {
return this.$refs.uToast.show({ return this.$refs.uToast.show({
title: '图片已超出最大数量', title: '图片已超出最大数量',
type: 'error', type: 'error'
}) });
} }
this.photoItem = { this.photoItem = {
...JSON.parse(item), ...JSON.parse(item),
groupIndex, groupIndex,
itemIndex, itemIndex
} };
// 弹窗展示 // 弹窗展示
this.maskShow = true this.maskShow = true;
}, },
// 区分上传动作 // 区分上传动作
uploadSelect(index) { uploadSelect(index) {
if (index === 0) { if (index === 0) {
this.uploadFile('photo') this.uploadFile('photo');
} else { } else {
this.uploadFile() this.uploadFile();
} }
}, },
// 拍照回调 // 拍照回调
...@@ -1215,72 +1107,68 @@ export default { ...@@ -1215,72 +1107,68 @@ export default {
orderNumber: this.orderNumber, orderNumber: this.orderNumber,
fieldsName: this.photoItem.fieldsName, fieldsName: this.photoItem.fieldsName,
fieldsTitle: this.photoItem.fieldsTitle, fieldsTitle: this.photoItem.fieldsTitle,
uploadType: 'camera', uploadType: 'camera'
} };
const value = await this.saveToTask(val, order) const value = await this.saveToTask(val, order);
this.$refs[ this.$refs[`fileChild${this.photoItem.groupIndex}${this.photoItem.itemIndex}`][0].setTmpValue(value);
`fileChild${this.photoItem.groupIndex}${this.photoItem.itemIndex}`
][0].setTmpValue(value)
} }
this.takeStatus = false this.takeStatus = false;
}, },
// 上传图片 // 上传图片
async uploadFile(type) { async uploadFile(type) {
const self = this const self = this;
if (type && type === 'photo') { if (type && type === 'photo') {
// 直接打开相册 // 直接打开相册
let options = { let options = {
sourceType: ['album'], //['album', 'camera'] sourceType: ['album'], //['album', 'camera']
count: 3, count: 3,
sizeType: ['original'], sizeType: ['original']
} };
const order = { const order = {
orderNumber: this.orderNumber, orderNumber: this.orderNumber,
fieldsName: this.photoItem.fieldsName, fieldsName: this.photoItem.fieldsName,
fieldsTitle: this.photoItem.fieldsTitle, fieldsTitle: this.photoItem.fieldsTitle,
uploadType: 'album', uploadType: 'album'
} };
const value = await this.chooseImg(options, order) const value = await this.chooseImg(options, order);
self.$refs[ self.$refs[`fileChild${self.photoItem.groupIndex}${self.photoItem.itemIndex}`][0].setTmpValue(value);
`fileChild${self.photoItem.groupIndex}${self.photoItem.itemIndex}` return;
][0].setTmpValue(value)
return
} }
// 使用拍照工具拍摄 // 使用拍照工具拍摄
this.photograph() this.photograph();
this.getWatermark() this.getWatermark();
}, },
// 获取拍照规范 // 获取拍照规范
photograph() { photograph() {
let self = this let self = this;
let param = { let param = {
partnerCompanyId: this.partnerCompanyId || '', partnerCompanyId: this.partnerCompanyId || '',
categoryId: this.categoryId, categoryId: this.categoryId,
brandId: this.brandId || '', brandId: this.brandId || '',
fieldName: this.photoItem.fieldsName, fieldName: this.photoItem.fieldsName
} };
this.$u.api.orderStandardItem(param).then((res) => { this.$u.api.orderStandardItem(param).then(res => {
if (res.code == 200 && res.data.length > 0) { if (res.code == 200 && res.data.length > 0) {
self.currentItemDate = res.data[0] self.currentItemDate = res.data[0];
} else { } else {
console.log('获取完工项的拍照标准异常', res.data.message) console.log('获取完工项的拍照标准异常', res.data.message);
} }
self.takeStatus = true self.takeStatus = true;
}) });
}, },
// 获取水印 // 获取水印
getWatermark() { getWatermark() {
if (getApp().globalData.photo.waterSetting) { if (getApp().globalData.photo.waterSetting) {
return return;
} }
var data = { partnerCompanyId: this.partnerCompanyId || '' } var data = { partnerCompanyId: this.partnerCompanyId || '' };
this.$u.api.getWatermark(data).then((res) => { this.$u.api.getWatermark(data).then(res => {
if (res.code == 200) { if (res.code == 200) {
getApp().globalData.photo.waterSetting = res.data getApp().globalData.photo.waterSetting = res.data;
} else { } else {
console.log('获取水印备注异常', res.data.message) console.log('获取水印备注异常', res.data.message);
} }
}) });
}, },
// ------------------------- 以上方法为上传组件相关 ------------------------- // ------------------------- 以上方法为上传组件相关 -------------------------
...@@ -1288,77 +1176,77 @@ export default { ...@@ -1288,77 +1176,77 @@ export default {
// 点击左边的栏目切换 // 点击左边的栏目切换
async swichMenu(index) { async swichMenu(index) {
if (this.arr.length == 0) { if (this.arr.length == 0) {
await this.getMenuItemTop() await this.getMenuItemTop();
} }
// if (index == this.current) return; // if (index == this.current) return;
this.scrollRightTop = this.oldScrollTop this.scrollRightTop = this.oldScrollTop;
this.$nextTick(function() { this.$nextTick(function() {
setTimeout(() => { setTimeout(() => {
// 没有指定滚动到某一小项,就滚动到大的项 // 没有指定滚动到某一小项,就滚动到大的项
this.scrollRightTop = this.arr[index] this.scrollRightTop = this.arr[index];
this.current = index this.current = index;
}, 100) }, 100);
}) });
}, },
// 获取右边菜单每个item到顶部的距离 // 获取右边菜单每个item到顶部的距离
getMenuItemTop() { getMenuItemTop() {
new Promise((resolve) => { new Promise(resolve => {
let selectorQuery = uni.createSelectorQuery() let selectorQuery = uni.createSelectorQuery();
selectorQuery selectorQuery
.selectAll('.class-item') .selectAll('.class-item')
.boundingClientRect((rects) => { .boundingClientRect(rects => {
// 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行 // 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行
if (!rects.length) { if (!rects.length) {
setTimeout(() => { setTimeout(() => {
this.getMenuItemTop() this.getMenuItemTop();
}, 10) }, 10);
return return;
} }
rects.forEach((rect) => { rects.forEach(rect => {
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况) // 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况)
this.arr.push(rect.top - rects[0].top) this.arr.push(rect.top - rects[0].top);
resolve() resolve();
}) });
})
.exec()
}) })
.exec();
});
}, },
// 右边菜单滚动 // 右边菜单滚动
async rightScroll(e) { async rightScroll(e) {
this.oldScrollTop = e.detail.scrollTop this.oldScrollTop = e.detail.scrollTop;
if (this.arr.length == 0) { if (this.arr.length == 0) {
await this.getMenuItemTop() await this.getMenuItemTop();
} }
if (this.timer) return if (this.timer) return;
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
// 节流 // 节流
this.timer = null this.timer = null;
// scrollHeight为右边菜单垂直中点位置 // scrollHeight为右边菜单垂直中点位置
let scrollHeight = e.detail.scrollTop let scrollHeight = e.detail.scrollTop;
for (let i = 0; i < this.arr.length; i++) { for (let i = 0; i < this.arr.length; i++) {
let height1 = this.arr[i] let height1 = this.arr[i];
let height2 = this.arr[i + 1] let height2 = this.arr[i + 1];
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可 // 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
if (!height2 || (scrollHeight >= height1 && scrollHeight < height2)) { if (!height2 || (scrollHeight >= height1 && scrollHeight < height2)) {
this.current = i this.current = i;
return return;
} }
} }
}, 100) }, 100);
}, },
handleTouchstart() { handleTouchstart() {
// 防止输入光标滚动出现错乱 // 防止输入光标滚动出现错乱
uni.hideKeyboard() uni.hideKeyboard();
}, },
// 返回上一页更新订单状态 // 返回上一页更新订单状态
backGo() { backGo() {
// const pages = getCurrentPages() // const pages = getCurrentPages()
// const beforePage = pages[pages.length - 2] // const beforePage = pages[pages.length - 2]
// if (beforePage.$vm.loadOrderDetail) beforePage.$vm.loadOrderDetail() // if (beforePage.$vm.loadOrderDetail) beforePage.$vm.loadOrderDetail()
uni.navigateBack() uni.navigateBack();
}, }
}, }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment