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 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 inventoryListByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/take/stock/take/stock', params); let deleteInventoryByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
'/take/stock/detail/delete/' + params);
/** /**
* 收货单详情 * 提交盘点
*/ */
let inventoryDetailByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/take/stock/sign/detail/'+ params); let confirmInventoryByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
'/take/stock/take/submit/' + params);
/** /**
* 确认收货 * 提交盘点
*/ */
let addInventoryByInventoryModules = async (params = {}) => await vm.$u.post(parts + vm.vuex_token + '/take/stock/detail/add', params,formType); 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
} }
module.exports = { module.exports = {
inventoryApiFun inventoryApiFun
} }
// 自定义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
}) })
} }
...@@ -46,4 +46,12 @@ export function showModal({ ...@@ -46,4 +46,12 @@ export function showModal({
} }
}); });
}, 1); }, 1);
} }
\ No newline at end of file
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
} }
}, },
......
<template> <template>
<TabBarPage title="扳手会" :fixed="true" @click="goTop"> <TabBarPage title="扳手会" :fixed="true" @click="goTop">
<view class="content-view"> <view class="content-view">
<scroll-view <scroll-view
style="height: 100%;" style="height: 100%;"
scroll-y scroll-y
@scrolltolower="reachBottom" @scrolltolower="reachBottom"
:scroll-top="scrollTop" :scroll-top="scrollTop"
@scroll="scroll" @scroll="scroll"
scroll-anchoring scroll-anchoring
refresher-enabled="true" refresher-enabled="true"
:refresher-triggered="triggered" :refresher-triggered="triggered"
:refresher-threshold="100" :refresher-threshold="100"
refresher-background="#F4F5F7" refresher-background="#F4F5F7"
@refresherrefresh="onRefresh" @refresherrefresh="onRefresh"
@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" <view class="msg-view">
@click="handleClickBanner" <view class="msg-title">最新消息</view>
></image> <view class="msg-list-view">
<view class="msg-content" v-for="(item, index) in messageList" :key="index" @click="toNewsDetail(item)">
<view class="msg-view"> <view class="msg-content-view">
<view class="msg-title">最新消息</view> <view class="left-view">
<view class="msg-list-view"> <image class="msg-icon" :src="msgStyleImage[item.is_top]"></image>
<view <text class="msg-text">{{ item.title }}</text>
class="msg-content" </view>
v-for="(item, index) in messageList" <image class="right-icon" :src="shouyeyouImage"></image>
:key="index" </view>
@click="toNewsDetail(item)" <view class="line-view" v-if="index != 1"></view>
> </view>
<view class="msg-content-view"> </view>
<view class="left-view"> </view>
<image <view class="sticky"><text>订单推荐</text></view>
class="msg-icon" <view class="order-view">
:src="msgStyleImage[item.is_top]" <!-- 入驻成功之后显示推荐订单列表 -->
></image> <view class="order-list-view" v-if="loaded">
<text class="msg-text">{{ item.title }}</text> <!-- 入驻前-->
</view> <view v-if="needSettled" class="tip-view">
<image class="right-icon" :src="shouyeyouImage"></image> <image :src="weiruzhuImage" class="tip-view-image"></image>
</view> <view class="tip-other">入驻后平台将向您分配或推荐订单</view>
<view class="line-view" v-if="index != 1"></view> <u-button class="settle-button" type="primary" shape="circle" @click="immediatelyIn" :custom-style="buttonStyle">立即入驻</u-button>
</view> </view>
</view> <template v-else>
</view> <!-- 入驻成功之后无推荐订单 -->
<view class="sticky"> <view v-if="orderList.length <= 0 && loadedOrder" class="no-order-view"><NoOrder /></view>
<text>订单推荐</text> <view v-else-if="orderList.length > 0" class="order-item-view">
</view> <view v-for="(item, index) in orderList" :key="index">
<view class="order-view"> <OrderCell :orderData="item" type="waitAccept" :location="location" @click="handleClick" @action="handleClick"></OrderCell>
<!-- 入驻成功之后显示推荐订单列表 --> </view>
<view class="order-list-view" v-if="loaded"> <view class="load-more-view" v-show="(search.pageNumber == 1 && loadedOrder) || search.pageNumber > 1">
<!-- 入驻前--> <u-loadmore :status="currentLoadStatus" bgColor="#F4F5F7"></u-loadmore>
<view v-if="needSettled" class="tip-view"> </view>
<image :src="weiruzhuImage" class="tip-view-image"></image> </view>
<view class="tip-other">入驻后平台将向您分配或推荐订单</view> </template>
<u-button </view>
class="settle-button" </view>
type="primary" <view class="bottom-view" v-if="needSettled || orderList.length <= 0">
shape="circle" <view class="bottom-line-view"></view>
@click="immediatelyIn" <view class="bottom-text">我也是有底线哒</view>
:custom-style="buttonStyle" <view class="bottom-line-view"></view>
> </view>
立即入驻 </scroll-view>
</u-button> <!-- 悬浮按钮 -->
</view> <!-- <EusingList /> -->
<template v-else> </view>
<!-- 入驻成功之后无推荐订单 --> <upload-progress />
<view <MaskTip :show="showMask" imageName="mengceng2.png" :imageStyle="imageStyle" name="upload_tip" />
v-if="orderList.length <= 0 && loadedOrder" </TabBarPage>
class="no-order-view"
>
<NoOrder />
</view>
<view v-else-if="orderList.length > 0" class="order-item-view">
<view v-for="(item, index) in orderList" :key="index">
<OrderCell
:orderData="item"
type="waitAccept"
:location="location"
@click="handleClick"
@action="handleClick"
>
</OrderCell>
</view>
<view
class="load-more-view"
v-show="
(search.pageNumber == 1 && loadedOrder) ||
search.pageNumber > 1
"
>
<u-loadmore
:status="currentLoadStatus"
bgColor="#F4F5F7"
></u-loadmore>
</view>
</view>
</template>
</view>
</view>
<view class="bottom-view" v-if="needSettled || orderList.length <= 0">
<view class="bottom-line-view"></view>
<view class="bottom-text">我也是有底线哒</view>
<view class="bottom-line-view"></view>
</view>
</scroll-view>
<!-- 悬浮按钮 -->
<!-- <EusingList /> -->
</view>
<upload-progress />
<MaskTip
:show="showMask"
imageName="mengceng2.png"
:imageStyle="imageStyle"
name="upload_tip"
/>
</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 {
components: { components: {
OrderCell, OrderCell,
TabBarPage, TabBarPage,
NoOrder, NoOrder,
MaskTip, MaskTip
// EusingList, // EusingList,
}, },
data() { data() {
return { return {
status: 0, // 入驻状态:0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',6=>'已签约',7=>'已支付保证金',8=>'已通过考试',9=>'待提交' status: 0, // 入驻状态:0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',6=>'已签约',7=>'已支付保证金',8=>'已通过考试',9=>'待提交'
location: [], // 经纬度 location: [], // 经纬度
// title: false, // title: false,
// title: 'Hello', // title: 'Hello',
loaded: false, loaded: false,
loadedOrder: false, loadedOrder: false,
needSettled: false, needSettled: false,
count: 0, // 推荐订单数量 count: 0, // 推荐订单数量
messageList: [], messageList: [],
currentLoadStatus: 'loading', currentLoadStatus: 'loading',
orderList: [], orderList: [],
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() {
return { return {
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', msgStyleImage() {
'toFinishCount', return {
'reviewingCount', '1': process.uniEnv.qn_base_url + 'zhiding.png', // 置顶
'exceptionCount', '0': process.uniEnv.qn_base_url + 'tongzhi.png' // 通知
] // '3': process.uniEnv.qn_base_url + "xiaoxi.png", // 消息
}, };
msgStyleImage() { },
return { bannerImage() {
'1': process.uniEnv.qn_base_url + 'zhiding.png', // 置顶 return process.uniEnv.qn_base_url + 'banner-1.png';
'0': process.uniEnv.qn_base_url + 'tongzhi.png', // 通知 },
// '3': process.uniEnv.qn_base_url + "xiaoxi.png", // 消息 shouyeyouImage() {
} return process.uniEnv.qn_base_url + 'shouyeyou.png';
}, },
bannerImage() { weiruzhuImage() {
return process.uniEnv.qn_base_url + 'weiruzhu.png';
return process.uniEnv.qn_base_url + 'banner-1.png' },
}, imageStyle() {
shouyeyouImage() { return 'width:628rpx; margin-top:816rpx; margin-left:122rpx';
return process.uniEnv.qn_base_url + 'shouyeyou.png' }
}, },
weiruzhuImage() { onLoad(e) {
return process.uniEnv.qn_base_url + 'weiruzhu.png' app.trackPage('自营平台首页');
}, this.freshing = false;
imageStyle() { if (this.vuex_token) {
return 'width:628rpx; margin-top:816rpx; margin-left:122rpx' this.getOrderCount();
} } else {
}, this.waitInit = true;
onLoad(e) { }
app.trackPage('自营平台首页') this.showMaskTip();
this._freshing = false },
if (this.vuex_token) { onShow() {
this.getOrderCount() // 每次进入页面都刷新入驻状态
} else { this.pageNumber = 0;
this.waitInit = true
} this.initSettleInfo();
this.showMaskTip() },
}, methods: {
onShow() { getData() {
// 每次进入页面都刷新入驻状态 this.getOrderCount();
this.pageNumber = 0 this.initSettleInfo();
},
this.initSettleInfo() handleClick(item, type, showCountTime) {
}, // 跳转工单详情页面 showCountTime:是否显示倒计时
methods: { // type类型
getData() { // 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
this.getOrderCount() uni.navigateTo({
this.initSettleInfo() url: 'pages/order/detail?id=' + item.orderId + '&type=' + type + '&showCountTime=' + showCountTime
}, });
handleClick(item, type, showCountTime) { },
// 跳转工单详情页面 showCountTime:是否显示倒计时 async initSettleInfo() {
// type类型 let self = this;
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息 // 加载消息列表
uni.navigateTo({ this.loadMessageList();
url: if (this.vuex_token) {
'pages/order/detail?id=' + const callBack = (vm, result) => {
item.orderId + // 后台自动判断入驻流程是否完成,前台通过status确定状态
'&type=' + if (result && result.record) {
type + // 不返回该字段或返回true代表需要入驻
'&showCountTime=' + vm.needSettled = result.needSettled == undefined ? true : result.needSettled;
showCountTime, vm.status = Number(result.record.status || '0');
}) // vm.status = 8
}, }
async initSettleInfo() { };
let self = this self.search.pageNumber = 0;
// 加载消息列表 self.loadedOrder = false;
this.loadMessageList() await app.getBaseInfo(self, callBack);
if (this.vuex_token) { if (this.status == 7) {
const callBack = (vm, result) => { this.getLocation();
// 后台自动判断入驻流程是否完成,前台通过status确定状态 self.loadOrderList();
if (result && result.record) { }
// 不返回该字段或返回true代表需要入驻 this.loaded = true;
vm.needSettled = result.needSettled == undefined ? true : result.needSettled } else {
vm.status = Number(result.record.status || '0') this.loaded = true;
// vm.status = 8 }
} },
} loadMessageList() {
self.search.pageNumber = 0 let self = this;
self.loadedOrder = false self.$u.api.listByNotice().then(res => {
await app.getBaseInfo(self, callBack) uni.stopPullDownRefresh(); // 结束下拉刷新
if (this.status == 7) { if (res.code == 200) {
this.getLocation() if (res.data && res.data.length > 2) {
self.loadOrderList() self.messageList = res.data.slice(0, 2);
} } else {
this.loaded = true self.messageList = res.data || [];
} else { }
this.loaded = true } else {
} console.log(res.message, '初始化消息列表异常');
}, }
loadMessageList() { });
let self = this },
self.$u.api.listByNotice().then((res) => { async loadOrderList() {
uni.stopPullDownRefresh() // 结束下拉刷新 this.search.pageNumber += 1;
if (res.code == 200) { let self = this;
if (res.data && res.data.length > 2) { // 加载订单列表
self.messageList = res.data.slice(0, 2) self.search.token = self.vuex_token;
} else { self.$u.api.listByRecommendOrder(self.search).then(res => {
self.messageList = res.data || [] self.loadedOrder = true;
}
} else { if (res.code == 200 && res.data) {
console.log(res.message, '初始化消息列表异常') if (self.search.pageNumber == 1) {
} self.orderList = [];
}) }
}, if (res.data.list) {
async loadOrderList() { // self.orderList.push(...res.data.list)
this.search.pageNumber += 1
let self = this // 更新每一条时间戳,防止后台返回的数据和原先一样,不触发ordercell的时间计算
// 加载订单列表 var time = new Date().getTime();
self.search.token = self.vuex_token for (var item of res.data.list) {
self.$u.api.listByRecommendOrder(self.search).then((res) => { item.currentCellTime = time;
self.loadedOrder = true self.orderList.push(item);
}
if (res.code == 200 && res.data) { }
if (self.search.pageNumber == 1) {
self.orderList = [] self.currentLoadStatus = res.data.total > self.orderList.length && (res.data.list || []).length == self.search.pageSize ? 'loadmore' : 'nomore';
} } else {
if (res.data.list) { console.log(res.message, '初始化订单列表异常');
// self.orderList.push(...res.data.list) }
self.$nextTick(() => {
// 更新每一条时间戳,防止后台返回的数据和原先一样,不触发ordercell的时间计算 if (self.freshing) {
var time = new Date().getTime() self.triggered = false;
for (var item of res.data.list) { self.freshing = false;
item.currentCellTime = time }
self.orderList.push(item) });
} });
} },
reachBottom() {
self.currentLoadStatus = if (this.vuex_token) {
res.data.total > self.orderList.length && if (this.currentLoadStatus != 'loadmore') return;
(res.data.list || []).length == self.search.pageSize this.currentLoadStatus == 'loading';
? 'loadmore' this.loadOrderList();
: 'nomore' }
} else { },
console.log(res.message, '初始化订单列表异常') onRefresh() {
} if (this.freshing) return;
self.$nextTick(() => { this.freshing = true;
if (self._freshing) { this.initSettleInfo();
self.triggered = false },
self._freshing = false onRestore() {
} this.triggered = 'restore'; // 需要重置
}) },
}) scroll(e) {
}, this.old.scrollTop = e.detail.scrollTop;
reachBottom() { },
if (this.vuex_token) { goTop(e) {
if (this.currentLoadStatus != 'loadmore') return this.scrollTop = this.old.scrollTop;
this.currentLoadStatus == 'loading' this.$nextTick(function() {
this.loadOrderList() this.scrollTop = 0;
} });
}, },
onRefresh() { /* 立即入驻 */
if (this._freshing) return immediatelyIn() {
this._freshing = true if (this.vuex_token) {
this.initSettleInfo() // 用户已登录
}, var pageIndex = 1;
onRestore() { // 0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',5=>'已签约',6=>'未支付保证金',7=>'已支付保证金',8=>'已通过考试',9=>'待提交'
this.triggered = 'restore' // 需要重置 switch (this.status) {
}, case 1:
scroll(e) { case 2:
this.old.scrollTop = e.detail.scrollTop case 3:
}, case 4:
goTop(e) { pageIndex = 2;
this.scrollTop = this.old.scrollTop break;
this.$nextTick(function() { case 8:
this.scrollTop = 0 pageIndex = 3;
}) break;
}, case 5:
/* 立即入驻 */ case 6:
immediatelyIn() { pageIndex = 4;
if (this.vuex_token) { break;
// 用户已登录 case 7:
var pageIndex = 1 pageIndex = 5;
// 0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',5=>'已签约',6=>'未支付保证金',7=>'已支付保证金',8=>'已通过考试',9=>'待提交' break;
switch (this.status) { default:
case 1: pageIndex = 1;
case 2: break;
case 3: }
case 4:
pageIndex = 2 uni.navigateTo({
break url: this.status > 0 ? '/pages/settle/prompt?pageIndex=' + pageIndex : '/pages/settle/index'
case 8: });
pageIndex = 3 } else {
break // 用户未登录
case 5: uni.navigateTo({
case 6: url: 'pages/login/index'
pageIndex = 4 });
break }
case 7: },
pageIndex = 5 // 获取订单数量
break getOrderCount() {
default: var self = this; // 加载订单列表
pageIndex = 1 self.$u.api.listOrderCount().then(res => {
break if (res.code == 200) {
} if (res.data) {
var count = 0;
uni.navigateTo({ for (var item of this.countKeys) {
url: count += res.data[item] || 0;
this.status > 0 }
? '/pages/settle/prompt?pageIndex=' + pageIndex // 修改tab总数
: '/pages/settle/index', if (count > 0) {
}) uni.setTabBarBadge({
} else { index: 1,
// 用户未登录 text: String(count)
uni.navigateTo({ });
url: 'pages/login/index', } else {
}) uni.removeTabBarBadge({
} index: 1
}, });
// 获取订单数量 }
getOrderCount() { }
var self = this // 加载订单列表 } else {
self.$u.api.listOrderCount().then((res) => { console.log(res.message, '获取订单数量失败!');
if (res.code == 200) { }
if (res.data) { });
var count = 0 },
for (var item of this.countKeys) { /**
count += res.data[item] || 0 * 获取当前位置的经纬度
} */
// 修改tab总数 getLocation() {
if (count > 0) { let self = this;
uni.setTabBarBadge({ uni.getLocation({
index: 1, type: 'gcj02',
text: String(count), success: function(res) {
}) self.location = [res.latitude, res.longitude];
} else { },
uni.removeTabBarBadge({ complete: function(res) {
index: 1, if (res.errMsg.indexOf('auth') != -1) {
}) uni.showModal({
} title: '提示',
} content: '获取权限失败,请到设置页面开启权限',
} else { confirmText: '好的',
console.log(res.message, '获取订单数量失败!') success(res) {
} if (res.confirm) {
}) uni.openSetting({
}, success(res) {
/** console.log(res.authSetting);
* 获取当前位置的经纬度 }
*/ });
getLocation() { }
let self = this }
uni.getLocation({ });
type: 'gcj02', }
success: function(res) { },
self.location = [res.latitude, res.longitude] fail: function(err) {}
}, });
complete: function(res) { },
if (res.errMsg.indexOf('auth') != -1) { toNewsDetail(item) {
uni.showModal({ wx.navigateTo({
title: '提示', url: '/pages/learn/news-details',
content: '获取权限失败,请到设置页面开启权限', success: function(res) {
confirmText: '好的', res.eventChannel.emit('acceptDataFromLearn', item);
success(res) { }
if (res.confirm) { });
uni.openSetting({ },
success(res) { handleClickBanner() {
console.log(res.authSetting) uni.navigateTo({
}, url: '/pages/mine/customer/index' + '?type=exclusive'
}) });
} },
}, // 显示提示蒙版
}) showMaskTip() {
} this.showMask = true;
}, }
fail: function(err) {}, }
}) };
},
toNewsDetail(item) {
wx.navigateTo({
url: '/pages/learn/news-details',
success: function(res) {
res.eventChannel.emit('acceptDataFromLearn', item)
},
})
},
handleClickBanner() {
uni.navigateTo({
url: '/pages/mine/customer/index' + '?type=exclusive',
})
},
// 显示提示蒙版
showMaskTip() {
this.showMask = true
},
},
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.banner-image { .banner-image {
width: 730rpx; width: 730rpx;
height: 280rpx; height: 280rpx;
margin-left: -16rpx; margin-left: -16rpx;
} }
.content-view { .content-view {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
} }
.msg-view { .msg-view {
.msg-title { .msg-title {
color: #333333; color: #333333;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
padding: 1rpx 0rpx 30rpx 0rpx; padding: 1rpx 0rpx 30rpx 0rpx;
} }
.msg-list-view { .msg-list-view {
border-radius: 12rpx; border-radius: 12rpx;
background-color: #ffffff; background-color: #ffffff;
padding: 12rpx 30rpx; padding: 12rpx 30rpx;
height: 174rpx; height: 174rpx;
} }
.msg-content { .msg-content {
color: #333333; color: #333333;
font-size: 26rpx; font-size: 26rpx;
.msg-content-view { .msg-content-view {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
margin-top: 20rpx; margin-top: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.left-view { .left-view {
display: flex; display: flex;
align-items: center; align-items: center;
.msg-icon { .msg-icon {
width: 80rpx; width: 80rpx;
height: 36rpx; height: 36rpx;
margin-right: 20rpx; margin-right: 20rpx;
} }
.msg-text { .msg-text {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
width: 448rpx; width: 448rpx;
} }
} }
.right-icon { .right-icon {
width: 14rpx; width: 14rpx;
height: 24rpx; height: 24rpx;
} }
} }
.line-view { .line-view {
height: 2rpx; height: 2rpx;
background-color: #f4f5f7; background-color: #f4f5f7;
} }
} }
} }
.logo { .logo {
height: 200 rpx; height: 200 rpx;
width: 100%; width: 100%;
margin: 0 rpx auto 50 rpx auto; margin: 0 rpx auto 50 rpx auto;
} }
.text-area { .text-area {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.title { .title {
font-size: 36 rpx; font-size: 36 rpx;
color: #8f8f94; color: #8f8f94;
} }
// .sticky-view { // .sticky-view {
...@@ -560,73 +492,73 @@ export default { ...@@ -560,73 +492,73 @@ export default {
// } // }
.sticky { .sticky {
background-color: #f4f5f7; background-color: #f4f5f7;
color: #fff; color: #fff;
padding: 24 rpx; padding: 24 rpx;
text-align: left; text-align: left;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
padding: 46rpx 0 28rpx 0; padding: 46rpx 0 28rpx 0;
} }
.order-view { .order-view {
text-align: center; text-align: center;
.order-list-view { .order-list-view {
.tip-view { .tip-view {
padding: 30rpx; padding: 30rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 12rpx; border-radius: 12rpx;
min-height: 460rpx; min-height: 460rpx;
.tip-view-image { .tip-view-image {
width: 328rpx; width: 328rpx;
height: 200rpx; height: 200rpx;
margin-top: 30rpx; margin-top: 30rpx;
} }
.tip-other { .tip-other {
font-size: 28rpx; font-size: 28rpx;
color: #666666; color: #666666;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.settle-button { .settle-button {
} }
} }
.order-item-view { .order-item-view {
background-color: #f4f5f7; background-color: #f4f5f7;
border-radius: 12rpx; border-radius: 12rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.load-more-view { .load-more-view {
padding-bottom: 44rpx; padding-bottom: 44rpx;
} }
} }
} }
} }
.bottom-view { .bottom-view {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 50rpx 40rpx 50rpx 40rpx; padding: 50rpx 40rpx 50rpx 40rpx;
.bottom-line-view { .bottom-line-view {
background-color: #d5d5d5; background-color: #d5d5d5;
height: 2rpx; height: 2rpx;
width: 30%; width: 30%;
} }
.bottom-text { .bottom-text {
color: #999999; color: #999999;
font-size: 24rpx; font-size: 24rpx;
} }
} }
.fixed-button { .fixed-button {
position: fixed; position: fixed;
right: 10rpx; right: 10rpx;
bottom: 64rpx; bottom: 64rpx;
} }
</style> </style>
<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> <image :src="bannerImage" mode="" class="banner"></image>
</u-navbar> <u-tabs-swiper
<image :src="bannerImage" mode="" class="banner"></image> bg-color="#F4F5F7"
<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> inactive-color="#999999"
<swiper class="swiper_group" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"> font-size="28"
<swiper-item @touchmove.stop.prevent="stopTouchMove"> ref="uTabs"
<scroll-view scroll-y style="width:100%;"> :list="tabs"
<view class="jf-currency-class"> :current="current"
<image :src="jianBianImg" mode="" class="current-img"></image> @change="tabsChange"
<view class="class1" style="position: relative;" @click="goToPrint"> :is-scroll="false"
<image class="jf-img" :src="rule.pic" mode=""></image> :bar-width="52"
<view class="right u-padding-top-10 u-padding-bottom-14 jf-right"> swiperWidth="750"
<view class="u-font-32 font-bold u-margin-left-30 u-margin-top-30">充电桩交付规范</view> ></u-tabs-swiper>
<view class="u-font-24 u-margin-left-30 u-margin-top-30">请点击学习</view> <swiper class="swiper_group" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
</view> <swiper-item @touchmove.stop.prevent="stopTouchMove">
<view class="jf-line u-margin-right-30 u-margin-top-60">去查看</view> <scroll-view scroll-y style="width:100%;">
</view> <view class="jf-currency-class">
</view> <image :src="jianBianImg" mode="" class="current-img"></image>
<view class="class1" style="position: relative;" @click="goToPrint">
<image class="jf-img" :src="rule.pic" mode=""></image>
<view class="right u-padding-top-10 u-padding-bottom-14 jf-right">
<view class="u-font-32 font-bold u-margin-left-30 u-margin-top-30">充电桩交付规范</view>
<view class="u-font-24 u-margin-left-30 u-margin-top-30">请点击学习</view>
</view>
<view class="jf-line u-margin-right-30 u-margin-top-60">去查看</view>
</view>
</view>
<view class="jf-currency-class u-margin-top-100"> <view class="jf-currency-class u-margin-top-100">
<image :src="jianbianImage" mode="" class="current-img"></image> <image :src="jianbianImage" mode="" class="current-img"></image>
<view class="class1" style="position: relative;" @click="goToDocument"> <view class="class1" style="position: relative;" @click="goToDocument">
<image class="jf-img" :src="anzhuangwenjianImage" mode=""></image> <image class="jf-img" :src="anzhuangwenjianImage" mode=""></image>
<view class="right u-padding-top-10 u-padding-bottom-14 jf-right"> <view class="right u-padding-top-10 u-padding-bottom-14 jf-right">
<view class="u-font-32 font-bold u-margin-left-30 u-margin-top-30">充电桩安装文件</view> <view class="u-font-32 font-bold u-margin-left-30 u-margin-top-30">充电桩安装文件</view>
<view class="u-font-24 u-margin-left-30 u-margin-top-30">请点击查看</view> <view class="u-font-24 u-margin-left-30 u-margin-top-30">请点击查看</view>
</view> </view>
<view class="jf-line u-margin-right-30 u-margin-top-60 red-color">去查看</view> <view class="jf-line u-margin-right-30 u-margin-top-60 red-color">去查看</view>
</view> </view>
</view>
</scroll-view>
</swiper-item>
<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"
>
<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-content">
<img :src="item.img" alt="" style="width:690rpx;height:260rpx;display:block" />
<view class="notice-content-bottom">
<view class="n-head">{{ item.title }}</view>
<view class="news">{{ item.text }}</view>
</view>
</view>
</view>
<view v-shou="isLoadMore" class="load-more"><u-loadmore :status="loadStatus" /></view>
</scroll-view>
</swiper-item>
<swiper-item @touchmove.stop.prevent="stopTouchMove" v-if="version">
<scroll-view scroll-y style="height:100%;width:100%;">
<view class="title u-margin-top-10 u-margin-bottom-30">通用课程</view>
<view class="learn-currency-class">
<view class="learn-class1" @click="goPlay(courselist[0])">
<image class="learn-img" :src="courselist[0].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc">
<view class="u-font-28 font-bold h68">{{ courselist[0].title }}</view>
<view class="u-font-20 learn-intro h48">{{ courselist[0].desc }}</view>
</view>
<view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[0].percent" :show-percent="false"></u-line-progress>
<text class="font-default-color" :class="{ 'font-active-color': courselist[0].percent }" v-text="courselist[0].status"></text>
</view>
</view>
<view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[1])">
<image class="learn-img" :src="courselist[1].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc">
<view class="u-font-28 font-bold h68">{{ courselist[1].title }}</view>
<view class="u-font-20 learn-intro h48">{{ courselist[1].desc }}</view>
</view>
<view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[1].percent" :show-percent="false"></u-line-progress>
<text class="font-default-color" :class="{ 'font-active-color': courselist[1].percent }" v-text="courselist[1].status"></text>
</view>
</view>
</view>
<view class="learn-currency-class u-margin-bottom-20 u-margin-top-30" style="padding-bottom: 300rpx;">
<view class="learn-class1" @click="goPlay(courselist[2])">
<image class="learn-img" :src="courselist[2].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc">
<view class="u-font-28 font-bold h68">{{ courselist[2].title }}</view>
<view class="u-font-20 learn-intro h48">{{ courselist[2].desc }}</view>
</view>
<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>
<text class="font-default-color" :class="{ 'font-active-color': courselist[2].percent }" v-text="courselist[2].status"></text>
</view>
</view>
<view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[3])">
<image class="learn-img" :src="courselist[3].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc">
<view class="u-font-28 font-bold h68">{{ courselist[3].title }}</view>
<view class="u-font-20 learn-intro h48">{{ courselist[3].desc }}</view>
</view>
<view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[3].percent" :show-percent="false"></u-line-progress>
<text class="font-default-color" :class="{ 'font-active-color': courselist[3].percent }" v-text="courselist[3].status"></text>
</view>
</view>
</view> </view>
</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="width:100%;">
<view v-for="item in list" :key="item.id" class="notice" @click="bbb(item)"> <view class="title u-margin-top-10 u-margin-bottom-30">通用认证</view>
<view class="notice-bottom-left">{{item.create_at}}</view> <view class="currency-class">
<view class="notice-content"> <view class="class1" @click="aaa(0)">
<img :src="item.img" alt="" style="width:690rpx;height:260rpx;display:block"> <image class="img" :src="examList[0].pic" mode=""></image>
<view class="notice-content-bottom"> <view class="right">
<view class="n-head">{{item.title}}</view> <view class="u-font-32 font-bold">{{ examList[0].title }}</view>
<view class="news">{{item.text}}</view> <view class="u-font-24">{{ examList[0].desc }}</view>
</view> <view class="u-font-24" style="display:flex;justify-content: space-between;">
</view> <text class="font-color-999999">{{ examList[0].condition }}</text>
</view> <text class="font-default-exam-color" :class="{ 'font-active-color': examList[0].isComplete }">{{ examList[0].status }}</text>
<view v-shou="isLoadMore" class="load-more"> </view>
<u-loadmore :status="loadStatus" /> </view>
</view> </view>
</scroll-view> <view class="class1 u-margin-top-40" @click="aaa(1)">
</swiper-item> <image class="img" :src="examList[1].pic" mode=""></image>
<swiper-item @touchmove.stop.prevent="stopTouchMove" v-if="version"> <view class="right">
<scroll-view scroll-y style="height:100%;width:100%;"> <view class="u-font-32 font-bold">{{ examList[1].title }}</view>
<view class="title u-margin-top-10 u-margin-bottom-30">通用课程</view> <view class="u-font-24">{{ examList[1].desc }}</view>
<view class="learn-currency-class"> <view class="u-font-24" style="display:flex;justify-content: space-between;">
<view class="learn-class1" @click="goPlay(courselist[0])"> <text class="font-color-999999">{{ examList[1].condition }}</text>
<image class="learn-img" :src="courselist[0].pic" mode=""></image> <text class="font-default-exam-color" :class="{ 'font-active-color': examList[1].isComplete }">{{ examList[1].status }}</text>
<image class="bofang" :src="bofang" mode=""></image> </view>
<view class="learn-desc"> </view>
<view class="u-font-28 font-bold h68"> </view>
{{ courselist[0].title }} </view>
</view> </scroll-view>
<view class="u-font-20 learn-intro h48"> </swiper-item>
{{ courselist[0].desc }} </swiper>
</view> </view>
</view>
<view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[0].percent" :show-percent="false">
</u-line-progress>
<text class="font-default-color" :class="{'font-active-color':courselist[0].percent}" v-text="courselist[0].status"></text>
</view>
</view>
<view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[1])">
<image class="learn-img" :src="courselist[1].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc">
<view class="u-font-28 font-bold h68">
{{ courselist[1].title }}
</view>
<view class="u-font-20 learn-intro h48">
{{ courselist[1].desc }}
</view>
</view>
<view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[1].percent" :show-percent="false">
</u-line-progress>
<text class="font-default-color" :class="{'font-active-color':courselist[1].percent}" v-text="courselist[1].status"></text>
</view>
</view>
</view>
<view class="learn-currency-class u-margin-bottom-20 u-margin-top-30" style="padding-bottom: 300rpx;">
<view class="learn-class1" @click="goPlay(courselist[2])">
<image class="learn-img" :src="courselist[2].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc">
<view class="u-font-28 font-bold h68">
{{ courselist[2].title }}
</view>
<view class="u-font-20 learn-intro h48">
{{ courselist[2].desc }}
</view>
</view>
<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>
<text class="font-default-color" :class="{'font-active-color':courselist[2].percent}" v-text="courselist[2].status"></text>
</view>
</view>
<view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[3])">
<image class="learn-img" :src="courselist[3].pic" mode=""></image>
<image class="bofang" :src="bofang" mode=""></image>
<view class="learn-desc">
<view class="u-font-28 font-bold h68">
{{ courselist[3].title }}
</view>
<view class="u-font-20 learn-intro h48">
{{ courselist[3].desc }}
</view>
</view>
<view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[3].percent" :show-percent="false">
</u-line-progress>
<text class="font-default-color" :class="{'font-active-color':courselist[3].percent}" v-text="courselist[3].status"></text>
</view>
</view>
</view>
</scroll-view>
</swiper-item>
<swiper-item @touchmove.stop.prevent="stopTouchMove">
<scroll-view scroll-y style="width:100%;">
<view class="title u-margin-top-10 u-margin-bottom-30">通用认证</view>
<view class="currency-class">
<view class="class1" @click="aaa(0)">
<image class="img" :src="examList[0].pic" mode=""></image>
<view class="right">
<view class="u-font-32 font-bold">
{{ examList[0].title }}
</view>
<view class="u-font-24">
{{ examList[0].desc }}
</view>
<view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[0].condition }}</text>
<text class="font-default-exam-color" :class="{'font-active-color':examList[0].isComplete}">
{{ examList[0].status }}
</text>
</view>
</view>
</view>
<view class="class1 u-margin-top-40" @click="aaa(1)">
<image class="img" :src="examList[1].pic" mode=""></image>
<view class="right">
<view class="u-font-32 font-bold">
{{examList[1].title}}
</view>
<view class="u-font-24">
{{ examList[1].desc }}
</view>
<view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[1].condition }}</text>
<text class="font-default-exam-color" :class="{'font-active-color':examList[1].isComplete}">
{{ examList[1].status }}</text>
</view>
</view>
</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
</template> </template>
<script> <script>
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];
let examListJson = examJson[env]; let examListJson = examJson[env];
export default { export default {
data() { data() {
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: [
{ {
title: courseListJson[0].title, title: courseListJson[0].title,
desc: courseListJson[0].desc, desc: courseListJson[0].desc,
percent: courseListJson[0].percent, percent: courseListJson[0].percent,
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,
desc: courseListJson[1].desc, desc: courseListJson[1].desc,
percent: courseListJson[1].percent, percent: courseListJson[1].percent,
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,
desc: courseListJson[2].desc, desc: courseListJson[2].desc,
percent: courseListJson[2].percent, percent: courseListJson[2].percent,
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,
desc: courseListJson[3].desc, desc: courseListJson[3].desc,
percent: courseListJson[3].percent, percent: courseListJson[3].percent,
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: [
{ {
title: examListJson[0].title, title: examListJson[0].title,
desc: examListJson[0].desc, desc: examListJson[0].desc,
condition: examListJson[0].condition, condition: examListJson[0].condition,
status: examListJson[0].status, status: examListJson[0].status,
pic: examListJson[0].pic, pic: examListJson[0].pic,
id: examListJson[0].id, id: examListJson[0].id,
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,
desc: examListJson[1].desc, desc: examListJson[1].desc,
condition: examListJson[1].condition, condition: examListJson[1].condition,
status: examListJson[1].status, status: examListJson[1].status,
pic: examListJson[1].pic, pic: examListJson[1].pic,
id: examListJson[1].id, id: examListJson[1].id,
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) {
this.current = param.tabs; this.current = param.tabs;
this.swiperCurrent = param.tabs; this.swiperCurrent = param.tabs;
} }
} catch (e) {} } catch (e) {}
this.getVersion(); this.getVersion();
}, },
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) {
try {
if (param.tabs) {
this.current = param.tabs;
this.swiperCurrent = param.tabs;
}
} catch (e) {}
if (this.current == 2 || this.current == 3) {
this.tabsChange(this.current);
}
},
methods: {
getVersion() {
let version = process.uniEnv.version_number;
let that = this;
this.$u.api
.getVersionInfo(version)
.then(res => {
let data = res.data;
if (data.hasOwnProperty('is_audit') && data.is_audit == 0) {
that.tabs = that.tabs2;
that.version = false;
}
})
.catch(err => {});
},
stopPull() {
let that = this;
setTimeout(function() {
that.triggered = false;
that.freshing = false;
}, 1000);
},
onPulling(e) {
return true;
},
onRefresh() {
if (this.freshing) return;
this.triggered = true;
this.freshing = true;
this.isLoadMore = false;
this.loadStatus = 'loading';
this.loadNews();
},
onRestore() {
this.triggered = 'restore'; // 需要重置
},
onAbort() {
console.log('onAbort');
},
transition(e) {
// swiper-item左右移动,通知tabs的滑块跟随移动
let dx = e.detail.dx;
this.$refs.uTabs.setDx(dx);
},
//scroll-view到底部加载更多
onreachBottom() {
//上拉触底函数
if (!this.isLoadMore) {
this.isLoadMore = true;
this.params.start += 5;
if (this.loadStatus !== 'nomore') {
this.getNoticeList();
}
}
},
stopTouchMove() {
return false;
}, },
}, //取文本第一张图片
onShow: function (param) { imgUrlFun(str) {
try { var data = '';
if (param.tabs) { str.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/, function(match, capture) {
this.current = param.tabs; data = capture;
this.swiperCurrent = param.tabs; });
} return data;
} catch (e) {} },
if (this.current == 2 || this.current == 3) { //取文本信息
this.tabsChange(this.current); getText(str) {
} return str
}, .replace(/<[^<>]+>/g, '')
methods: { .replace(/&nbsp;/gi, '')
getVersion() { .replace(/(\n)/g, '');
let version = process.uniEnv.version_number; },
let that = this; getNoticeList() {
this.$u.api let that = this;
.getVersionInfo(version) this.$u.api
.then((res) => { .getTrainingNoticeList(this.params)
let data = res.data; .then(res => {
if (data.hasOwnProperty("is_audit") && data.is_audit == 0) { that.stopPull();
that.tabs = that.tabs2; if (res.code != 200) {
that.version = false; uni.showToast({
} title: res.message,
}) icon: 'none'
.catch((err) => {}); });
}, that.isLoadMore = false;
stopPull() { if (that.params.start > 0) {
let that = this; that.page -= 5;
setTimeout(function () { }
that.triggered = false; }
that._freshing = false; if (res.data) {
}, 1000); let length = res.data.length;
}, for (let i = 0; i < length; i++) {
onPulling(e) { res.data[i].create_at = this.timeFormat(res.data[i].create_at, 'yyyy.MM.dd hh:mm');
return true; res.data[i].img = this.imgUrlFun(res.data[i].body);
}, res.data[i].text = this.getText(res.data[i].body);
onRefresh() { }
if (this._freshing) return; that.list = that.list.concat(res.data);
this.triggered = true; console.log('消息列表', that.list);
this._freshing = true; }
this.isLoadMore = false; if (res.data.length >= 5) {
this.loadStatus = "loading"; that.isLoadMore = false;
this.loadNews(); } else {
}, that.isLoadMore = true;
onRestore() { that.loadStatus = 'nomore';
this.triggered = "restore"; // 需要重置 }
}, })
onAbort() { .catch(err => {
console.log("onAbort"); uni.showToast({
}, title: err,
transition(e) { icon: 'none'
// swiper-item左右移动,通知tabs的滑块跟随移动 });
let dx = e.detail.dx; that.isLoadMore = false;
this.$refs.uTabs.setDx(dx); if (that.params.start > 0) {
}, that.page -= 5;
//scroll-view到底部加载更多 }
onreachBottom() { });
//上拉触底函数 },
if (!this.isLoadMore) { timeFormat(time, format, fromMysql = true) {
this.isLoadMore = true; let rate = fromMysql ? 1000 : 1;
this.params.start += 5; let dataFmt = format || 'yyyy-MM-dd hh:mm:ss'; // 需要格式化的规则
if (this.loadStatus !== "nomore") { time = typeof time == 'number' ? time : new Date(time * rate); // 处理传入的time
this.getNoticeList(); let fmt = {
} 'y+': time.getFullYear(), // 年份
} 'M+': time.getMonth() + 1, // 月份
}, 'd+': time.getDate(), // 日
stopTouchMove() { 'h+': time.getHours(), // 小时
return false; 'm+': time.getMinutes(), // 分钟
}, 's+': time.getSeconds() // 秒
//取文本第一张图片 };
imgUrlFun(str) {
var data = "";
str.replace(
/<img [^>]*src=['"]([^'"]+)[^>]*>/,
function (match, capture) {
data = capture;
}
);
return data;
},
//取文本信息
getText(str) {
return str
.replace(/<[^<>]+>/g, "")
.replace(/&nbsp;/gi, "")
.replace(/(\n)/g, "");
},
getNoticeList() {
let that = this;
this.$u.api
.getTrainingNoticeList(this.params)
.then((res) => {
that.stopPull();
if (res.code != 200) {
uni.showToast({
title: res.message,
icon: "none",
});
that.isLoadMore = false;
if (that.params.start > 0) {
that.page -= 5;
}
}
if (res.data) {
let length = res.data.length;
for (let i = 0; i < length; i++) {
res.data[i].create_at = this.timeFormat(
res.data[i].create_at,
"yyyy.MM.dd hh:mm"
);
res.data[i].img = this.imgUrlFun(res.data[i].body);
res.data[i].text = this.getText(res.data[i].body);
}
that.list = that.list.concat(res.data);
console.log("消息列表", that.list);
}
if (res.data.length >= 5) {
that.isLoadMore = false;
} else {
that.isLoadMore = true;
that.loadStatus = "nomore";
}
})
.catch((err) => {
uni.showToast({
title: err,
icon: "none",
});
that.isLoadMore = false;
if (that.params.start > 0) {
that.page -= 5;
}
});
},
timeFormat(time, format, fromMysql = true) {
let rate = fromMysql ? 1000 : 1;
let dataFmt = format || "yyyy-MM-dd hh:mm:ss"; // 需要格式化的规则
time = typeof time == "number" ? time : new Date(time * rate); // 处理传入的time
let fmt = {
"y+": time.getFullYear(), // 年份
"M+": time.getMonth() + 1, // 月份
"d+": time.getDate(), // 日
"h+": time.getHours(), // 小时
"m+": time.getMinutes(), // 分钟
"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;
} },
} getTypeName(percent) {
return dataFmt; if (percent == 0) {
}, return '未开始';
getTypeName(percent) { } else if (percent == '100') {
if (percent == 0) { return '已完成';
return "未开始"; } else {
} else if (percent == "100") { return '继续';
return "已完成"; }
} else { },
return "继续"; //在线学习通用课程信息
} getCourseList() {
}, let courseLength = this.courselist.length;
//在线学习通用课程信息 for (let i = 0; i < courseLength; i++) {
getCourseList() { let param = {
let courseLength = this.courselist.length; course_id: this.courselist[i].id
for (let i = 0; i < courseLength; i++) { };
let param = { this.$u.api
course_id: this.courselist[i].id, .CourseList(param)
}; .then(res => {
this.$u.api if (res.code != 200) {
.CourseList(param) uni.showToast({
.then((res) => { title: res.message,
if (res.code != 200) { icon: 'none'
uni.showToast({ });
title: res.message, }
icon: "none", if (res.data) {
}); res.data.learnedInfo.learnPercent *= 100;
} this.courselist[i].status = this.getTypeName(res.data.learnedInfo.learnPercent);
if (res.data) { this.courselist[i].percent = res.data.learnedInfo.learnPercent;
res.data.learnedInfo.learnPercent *= 100; this.courselist[i].sectionId = res.data.learnedInfo.nextLearnedSectionId;
this.courselist[i].status = this.getTypeName( }
res.data.learnedInfo.learnPercent })
); .catch(err => {
this.courselist[i].percent = uni.showToast({
res.data.learnedInfo.learnPercent; title: err,
this.courselist[i].sectionId = icon: 'none'
res.data.learnedInfo.nextLearnedSectionId; });
} });
}) }
.catch((err) => { },
uni.showToast({ //tabs通知swiper切换
title: err, tabsChange(index) {
icon: "none", this.swiperCurrent = Number(index);
}); switch (this.swiperCurrent) {
}); case 1:
} this.loadNews();
}, break;
//tabs通知swiper切换 case 2:
tabsChange(index) { this.getCourseList();
this.swiperCurrent = Number(index); break;
switch (this.swiperCurrent) { case 3:
case 1: this.getUserExamInfo();
this.loadNews(); break;
break; }
case 2: },
this.getCourseList(); loadNews() {
break; this.params.start = 0;
case 3: this.list = [];
this.getUserExamInfo(); this.getNoticeList();
break; },
} animationfinish(e) {
}, let current = e.detail.current;
loadNews() { this.$refs.uTabs.setFinishCurrent(current);
this.params.start = 0; this.swiperCurrent = current;
this.list = []; this.current = current;
this.getNoticeList(); },
}, //跳转到拍照小程序首页
animationfinish(e) { goToPrint() {
let current = e.detail.current; uni.navigateToMiniProgram({
this.$refs.uTabs.setFinishCurrent(current); appId: 'wxd1d6eede324b0465',
this.swiperCurrent = current; path: '/pages/photo/index',
this.current = current; success(res) {
}, //打开成功
//跳转到拍照小程序首页 console.log('success', res);
goToPrint() { },
uni.navigateToMiniProgram({ fail(err) {
appId: "wxd1d6eede324b0465", console.log('err', err);
path: "/pages/photo/index", }
success(res) { });
//打开成功 },
console.log("success", res);
},
fail(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() {
uni.hideLoading(); uni.hideLoading();
let that = this; let that = this;
let token = that.vuex_token; let token = that.vuex_token;
let length = this.examList.length; let length = this.examList.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
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未参与
that.exam = res.data; that.exam = res.data;
if (res.data.examStatus == 2) { if (res.data.examStatus == 2) {
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; }
} if (res.data.examStatus == 0) {
if (res.data.examStatus == 0) { 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: "获取考试信息失败", });
}); });
}); }
} },
}, //跳转到assessment页面
//跳转到assessment页面 aaa(index) {
aaa(index) { //examStatus 用户考试状态 0考试中 1考试完成 2未参与
//examStatus 用户考试状态 0考试中 1考试完成 2未参与 //考试完成分成通过、未通过
//考试完成分成通过、未通过 getApp().globalData.questionTime = this.examList[index].questionTime;
getApp().globalData.questionTime = var examInfo = this.examList[index];
this.examList[index].questionTime; wx.navigateTo({
var examInfo = this.examList[index]; url: '/pages/learn/assessment?examId=' + examInfo.id
wx.navigateTo({ });
url: "/pages/learn/assessment?examId=" + examInfo.id, },
}); //跳转到播放
}, goPlay(info) {
//跳转到播放 getApp().track('learn_allPlayCounts', { courseId: info.id });
goPlay(info) { if (info.title === '小程序使用指南') {
getApp().track("learn_allPlayCounts", {courseId: info.id}) getApp().track('learn_guidePlayCounts', { courseId: info.id });
if(info.title === "小程序使用指南") { }
getApp().track("learn_guidePlayCounts", {courseId: info.id}) uni.navigateTo({
} url: '/pages/learn/section?section_id=' + info.sectionId + '&course_id=' + info.id
uni.navigateTo({ });
url: },
"/pages/learn/section?section_id=" + //跳转到消息详情页
info.sectionId + bbb(e) {
"&course_id=" + var news = {
info.id, body: e.body,
}); title: e.title,
}, create_at: e.create_at
//跳转到消息详情页 };
bbb(e) { getApp().track('learn_goToMessage', {});
var news = { let that = this;
body: e.body, wx.navigateTo({
title: e.title, url: '/pages/learn/news-details',
create_at: e.create_at, success: function(res) {
}; res.eventChannel.emit('acceptDataFromLearn', news);
getApp().track("learn_goToMessage", {}) }
let that = this; });
wx.navigateTo({ }
url: "/pages/learn/news-details", }
success: function (res) {
res.eventChannel.emit("acceptDataFromLearn", news);
},
});
},
},
}; };
</script> </script>
<style> <style>
.study { .study {
height: 100vh; height: 100vh;
background-color: #f4f5f7; background-color: #f4f5f7;
padding: 0rpx 30rpx 0 30rpx; padding: 0rpx 30rpx 0 30rpx;
} }
.title-view { .title-view {
color: #333333; color: #333333;
font-weight: bold; font-weight: bold;
font-size: 40rpx; font-size: 40rpx;
} }
.banner { .banner {
width: 690rpx; width: 690rpx;
height: 220rpx; height: 220rpx;
margin-top: 10rpx; margin-top: 10rpx;
} }
/* 交付规范 */ /* 交付规范 */
.standard { .standard {
width: 690rpx; width: 690rpx;
height: 180rpx; height: 180rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
/* border-bottom: 1rpx solid #82848a; */ /* border-bottom: 1rpx solid #82848a; */
/* padding: 0 34rpx; */ /* padding: 0 34rpx; */
/* margin: 72rpx auto; */ /* margin: 72rpx auto; */
border-radius: 12rpx; border-radius: 12rpx;
padding: 30rpx; padding: 30rpx;
margin-top: 30rpx; margin-top: 30rpx;
background-color: #ffffff; background-color: #ffffff;
} }
/* 培训通知 */ /* 培训通知 */
.notice { .notice {
/* border: #808080 solid 2rpx; */ /* border: #808080 solid 2rpx; */
width: 100%; width: 100%;
min-height: 370rpx; min-height: 370rpx;
margin-top: 36rpx; margin-top: 36rpx;
overflow: hidden; overflow: hidden;
border-radius: 12rpx; border-radius: 12rpx;
} }
.notice-content { .notice-content {
background: #ffffff; background: #ffffff;
width: 100%; width: 100%;
border-radius: 12rpx; border-radius: 12rpx;
overflow: hidden; overflow: hidden;
} }
.notice-content-bottom { .notice-content-bottom {
height: 150rpx; height: 150rpx;
padding: 0 30rpx; padding: 0 30rpx;
overflow: hidden; overflow: hidden;
} }
.n-head { .n-head {
text-align: left; text-align: left;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
margin-top: 30rpx; margin-top: 30rpx;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.news { .news {
overflow: hidden; overflow: hidden;
/* margin-top: 30rpx; */ /* margin-top: 30rpx; */
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: 24rpx; font-size: 24rpx;
color: #666666; color: #666666;
line-height: 34rpx; line-height: 34rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
margin-top: 16rpx; margin-top: 16rpx;
} }
/* 在线学习 */ /* 在线学习 */
.currency-class { .currency-class {
width: 100%; width: 100%;
background: #ffffff; background: #ffffff;
padding: 30rpx; padding: 30rpx;
border-radius: 12rpx; border-radius: 12rpx;
} }
.learn-currency-class { .learn-currency-class {
width: 100%; width: 100%;
border-radius: 12rpx; border-radius: 12rpx;
display: flex; display: flex;
} }
.jf-currency-class { .jf-currency-class {
width: 100%; width: 100%;
height: 180rpx; height: 180rpx;
/* position: absolute; */ /* position: absolute; */
position: relative; position: relative;
border-radius: 12rpx; border-radius: 12rpx;
margin-top: 80rpx; margin-top: 80rpx;
} }
.title { .title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
font-family: PingFang-SC-Bold, PingFang-SC; font-family: PingFang-SC-Bold, PingFang-SC;
} }
.class1 { .class1 {
display: -webkit-box; display: -webkit-box;
display: -webkit-flex; display: -webkit-flex;
display: flex; display: flex;
-webkit-box-pack: justify; -webkit-box-pack: justify;
-webkit-justify-content: space-between; -webkit-justify-content: space-between;
justify-content: space-between; justify-content: space-between;
} }
.learn-class1 { .learn-class1 {
display: -webkit-box; display: -webkit-box;
display: -webkit-flex; display: -webkit-flex;
display: block; display: block;
-webkit-box-pack: justify; -webkit-box-pack: justify;
-webkit-justify-content: space-between; -webkit-justify-content: space-between;
justify-content: space-between; justify-content: space-between;
width: 330rpx; width: 330rpx;
height: 420rpx; height: 420rpx;
background-color: #ffffff; background-color: #ffffff;
position: relative; position: relative;
border-radius: 12rpx; border-radius: 12rpx;
} }
.img { .img {
width: 160rpx; width: 160rpx;
height: 120rpx; height: 120rpx;
border-radius: 12rpx; border-radius: 12rpx;
} }
.learn-img { .learn-img {
width: 330rpx; width: 330rpx;
height: 194rpx; height: 194rpx;
} }
.jf-img { .jf-img {
width: 160rpx; width: 160rpx;
height: 200rpx; height: 200rpx;
position: absolute; position: absolute;
bottom: 5rpx; bottom: 5rpx;
left: 30rpx; left: 30rpx;
border-radius: 10rpx; border-radius: 10rpx;
} }
.right { .right {
width: 434rpx; width: 434rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
} }
.intro { .intro {
color: #9999a6; color: #9999a6;
} }
.tab { .tab {
background: #fff; background: #fff;
height: 82rpx; height: 82rpx;
margin: 0 0; margin: 0 0;
} }
.text { .text {
margin: 0 40rpx; margin: 0 40rpx;
line-height: 82rpx; line-height: 82rpx;
color: #667eb5; color: #667eb5;
} }
.content { .content {
margin: 5px 0; margin: 5px 0;
height: 485rpx; height: 485rpx;
background: #fff; background: #fff;
} }
swiper { swiper {
height: 70vh; height: 70vh;
} }
.line-percent { .line-percent {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 24rpx; font-size: 24rpx;
color: #999999; color: #999999;
margin: 20rpx; margin: 20rpx;
margin-top: 25rpx; margin-top: 25rpx;
} }
.jf-line { .jf-line {
width: 120rpx; width: 120rpx;
height: 52rpx; height: 52rpx;
border-radius: 26rpx; border-radius: 26rpx;
background-color: #ffffff; background-color: #ffffff;
color: #2272ff; color: #2272ff;
text-align: center; text-align: center;
font-size: 24rpx; font-size: 24rpx;
line-height: 52rpx; line-height: 52rpx;
} }
.red-color { .red-color {
color: #FA5A49; color: #fa5a49;
} }
.u-progress { .u-progress {
width: 160rpx !important; width: 160rpx !important;
height: 12rpx !important; height: 12rpx !important;
background-color: #ececec; background-color: #ececec;
} }
.font-bold { .font-bold {
font-weight: bold; font-weight: bold;
} }
.font-default-color { .font-default-color {
color: #999999; color: #999999;
} }
.font-default-exam-color { .font-default-exam-color {
color: #fa5a49; color: #fa5a49;
} }
.font-active-color { .font-active-color {
color: #2272ff; color: #2272ff;
} }
.font-color-999999 { .font-color-999999 {
color: #999999; color: #999999;
} }
.standard-img { .standard-img {
width: 160rpx; width: 160rpx;
height: 120rpx; height: 120rpx;
} }
.standard-body { .standard-body {
height: 120rpx; height: 120rpx;
display: flex; display: flex;
} }
.standard-body-title { .standard-body-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
.jf-right { .jf-right {
padding-left: 190rpx; padding-left: 190rpx;
width: 460rpx; width: 460rpx;
color: #ffffff; color: #ffffff;
} }
.notice-bottom { .notice-bottom {
margin-top: 20rpx; margin-top: 20rpx;
display: block; display: block;
position: relative; position: relative;
} }
.notice-bottom-left { .notice-bottom-left {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
color: #999999; color: #999999;
text-align: center; text-align: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.notice-bottom-right { .notice-bottom-right {
font-size: 24rpx; font-size: 24rpx;
color: #2272ff; color: #2272ff;
float: right; float: right;
} }
.bofang { .bofang {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
position: absolute; position: absolute;
left: 130rpx; left: 130rpx;
top: 70rpx; top: 70rpx;
} }
.learn-desc { .learn-desc {
height: 138rpx; height: 138rpx;
margin-top: -10rpx; margin-top: -10rpx;
padding-top: 20rpx; padding-top: 20rpx;
padding-left: 20rpx; padding-left: 20rpx;
padding-right: 20rpx; padding-right: 20rpx;
} }
.learn-intro { .learn-intro {
color: #999999; color: #999999;
margin-top: 20rpx; margin-top: 20rpx;
font-size: 20rpx; font-size: 20rpx;
} }
.h48 { .h48 {
height: 48rpx; height: 48rpx;
} }
.current-img { .current-img {
width: 100%; width: 100%;
height: 180rpx; height: 180rpx;
position: absolute; position: absolute;
} }
.load-more { .load-more {
padding-top: 50rpx; padding-top: 50rpx;
padding-bottom: 200rpx; padding-bottom: 200rpx;
} }
.u-margin-top-100 { .u-margin-top-100 {
margin-top: 100rpx; margin-top: 100rpx;
} }
</style> </style>
...@@ -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 {
......
<template> <template>
<TabBarPage title="订单" :fixed="true" @click="goTop"> <TabBarPage title="订单" :fixed="true" @click="goTop">
<view class="tools-box"> <view class="tools-box">
<view class="search-sub"> <view class="search-sub">
<u-subsection <u-subsection
:current="curNow" :current="curNow"
:list="subList" :list="subList"
active-color="white" active-color="white"
bg-color="white" bg-color="white"
inactive-color="#666" inactive-color="#666"
button-color="#2272FF" button-color="#2272FF"
border-radius="36" border-radius="36"
@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> <text class="search-btn-text">搜订单</text>
<text class="search-btn-text">搜订单</text> </view>
</view> </view>
</view> <view class="u-tabs-box">
<view class="u-tabs-box"> <!-- 写两个是避免切换subsection时候,current不是0的时候底部蓝条有初始动画 -->
<!-- 写两个是避免切换subsection时候,current不是0的时候底部蓝条有初始动画 --> <view v-for="index of [0, 1]" :key="index">
<view v-for="index of [0, 1]" :key="index"> <u-tabs
<u-tabs v-show="curNow == index"
v-show="curNow == index" height="66"
height="66" activeColor="#2272FF"
activeColor="#2272FF" bg-color="none"
bg-color="none" inactive-color="#999"
inactive-color="#999" bar-height="4"
bar-height="4" bar-width="44"
bar-width="44" :offset="offset[index]"
:offset="offset[index]" :list="list[index]"
:list="list[index]" count="total"
count="total" :current="current[index]"
:current="current[index]" @change="change"
@change="change" :is-scroll="false"
:is-scroll="false" font-size="28"
font-size="28" bold
bold ></u-tabs>
></u-tabs> </view>
</view> </view>
</view>
<view class="tab-view"> <view class="tab-view">
<scroll-view <scroll-view
scroll-y scroll-y
style="height: 100%;width: 100%;" style="height: 100%;width: 100%;"
@scrolltolower="reachBottom" @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" :scroll-top="scrollTop"
refresher-background="#F4F5F7" refresher-background="#F4F5F7"
@refresherrefresh="onRefresh" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @refresherrestore="onRestore"
@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" <template v-else>
imageName="zwdd.png" <view v-for="item in orderList[curNow][current[curNow]]" :key="item.orderId">
:customStyle="noOrderCustomStyle" <OrderCell :orderData="item" :type="cellType" :location="dataValue" @click="handleClick" @action="handleClickCellButton"></OrderCell>
/> </view>
<template v-else> <view class="load-more-view" v-show="(pageNumber == 1 && loaded) || pageNumber > 1"><u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore></view>
<view </template>
v-for="item in orderList[curNow][current[curNow]]" <view class="loading-view" v-if="!loaded && !freshing"><u-loading mode="flower"></u-loading></view>
:key="item.orderId" </scroll-view>
> </view>
<OrderCell <!-- 悬浮按钮 -->
:orderData="item" <!-- <EusingList type="collapse" /> -->
:type="cellType" <MaskTip :show="showMask" imageName="mengceng1.png" :imageStyle="imageStyle" name="today_tip" />
:location="dataValue" </TabBarPage>
@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>
</template>
<view class="loading-view" v-if="!loaded && !_freshing">
<u-loading mode="flower"></u-loading>
</view>
</scroll-view>
</view>
<!-- 悬浮按钮 -->
<!-- <EusingList type="collapse" /> -->
<MaskTip
:show="showMask"
imageName="mengceng1.png"
:imageStyle="imageStyle"
name="today_tip"
/>
</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'
export default { export default {
components: { components: {
TabBarPage, TabBarPage,
OrderCell, OrderCell,
NoOrder, NoOrder,
MaskTip, MaskTip
// EusingList, // EusingList,
}, },
data() { data() {
return { return {
curNow: 0, curNow: 0,
pageNumber: 0, pageNumber: 0,
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() {
] return [[0, 0], [0, 44]];
}, },
offset() { sousuoImage() {
return [ return process.uniEnv.qn_base_url + 'sousuo.png';
[0, 0], },
[0, 44], // 每一种状态对应的tab的index
] types() {
}, return [
sousuoImage() { {
return process.uniEnv.qn_base_url + 'sousuo.png' waitAppointment: 0, // 待预约、
}, waitCheckIn: 1, // 待签到、
// 每一种状态对应的tab的index waitFinish: 2, // 待完工、
types() { audit: 3, // 审核中、
return [ exception: 4, // 异常单、
{ finish: 5 //已完工
waitAppointment: 0, // 待预约、 },
waitCheckIn: 1, // 待签到、 {
waitFinish: 2, // 待完工、 todayWaitContact: 0, // 今日待联系、
audit: 3, // 审核中、 todayWaitFinish: 1, // 今日待完工、
exception: 4, // 异常单、 todayException: 2 // 今日异常单、
finish: 5, //已完工 }
}, ];
{ },
todayWaitContact: 0, // 今日待联系、 // 每一个tab对应的状态
todayWaitFinish: 1, // 今日待完工、 indexStatus() {
todayException: 2, // 今日异常单、 return [['waitAppointment', 'waitCheckIn', 'waitFinish', 'audit', 'exception', 'finish'], ['todayWaitContact', 'todayWaitFinish', 'todayException']];
}, },
] // 订单数量接的返回数量的key
}, countKeys() {
// 每一个tab对应的状态 return [
indexStatus() { [
return [ 'toAppointmentCount',
[ 'toCheckinCount',
'waitAppointment', 'toFinishCount',
'waitCheckIn', 'reviewingCount',
'waitFinish', 'exceptionCount',
'audit', '' // 待完工没有数量
'exception', ],
'finish', ['todayContactCount', 'todayFinishCount', 'todayExceptionCount']
], ];
['todayWaitContact', 'todayWaitFinish', 'todayException'], },
] isFinish() {
}, return this.orderType == 'finish';
// 订单数量接的返回数量的key },
countKeys() { noMore() {
return [ return this.orderList[this.curNow][this.current[this.curNow]].length == 0 && this.loaded;
[ },
'toAppointmentCount', cellTypes() {
'toCheckinCount', return [['waitAppointment', 'waitCheckIn', 'waitFinish', 'audit', 'exception', 'finish'], ['', 'waitFinish', 'exception']];
'toFinishCount', },
'reviewingCount', // 仅用于传给OrderCell的type
'exceptionCount', cellType() {
'', // 待完工没有数量 return this.cellTypes[this.curNow][this.current[this.curNow]];
], },
['todayContactCount', 'todayFinishCount', 'todayExceptionCount'], noOrderCustomStyle() {
] return 'margin-top: 100rpx;background-color: #F4F5F7';
}, },
isFinish() { imageStyle() {
return this.orderType == 'finish' return 'width:546rpx; margin-top:80rpx; margin-left:100rpx';
}, }
noMore() { },
return ( onLoad(e) {
this.orderList[this.curNow][this.current[this.curNow]].length == 0 && getApp().trackPage('订单首页');
this.loaded this.freshing = false;
) // 跳转到本页是否带了跳到那个tab的参数
}, if (e && e.type) {
cellTypes() { this.current[this.curNow] = Math.max(0, this.indexStatus[this.curNow].indexOf(e.type));
return [ }
[ },
'waitAppointment', onShow() {
'waitCheckIn', if (this.uploadTask.length > 0) {
'waitFinish', upload.uploadImageTask(this);
'audit', }
'exception', this.reloadOrderInfo();
'finish', },
], methods: {
['', 'waitFinish', 'exception'], sectionChange(index) {
] this.curNow = index;
}, this.reloadOrderList();
// 仅用于传给OrderCell的type },
cellType() { // tab栏切换
return this.cellTypes[this.curNow][this.current[this.curNow]] change(index) {
}, this.current[this.curNow] = index;
noOrderCustomStyle() { this.reloadOrderList();
return 'margin-top: 100rpx;background-color: #F4F5F7' },
}, // 滚动底部
imageStyle() { reachBottom(e) {
return 'width:546rpx; margin-top:80rpx; margin-left:100rpx' if (this.loadStatus != 'loadmore') return;
} this.loadStatus == 'loading';
}, this.getOrderList();
onLoad(e) { },
getApp().trackPage('订单首页') // 页面数据
this._freshing = false getOrderList() {
// 跳转到本页是否带了跳到那个tab的参数 // 状态处理
if (e && e.type) { this.pageNumber += 1;
this.current[this.curNow] = Math.max( if (this.pageNumber == 1) {
0, this.loaded = false;
this.indexStatus[this.curNow].indexOf(e.type) }
) var param = {
} pageNumber: this.pageNumber,
}, pageSize: this.pageSize,
onShow() { keyword: '',
if (this.uploadTask.length > 0) { type: this.orderType
upload.uploadImageTask(this) };
} var self = this;
this.reloadOrderInfo() self.$u.api.listOrder(param).then(res => {
}, if (res.code == 200) {
methods: { if (res.data.type != self.orderType) return; // 已切换到其他tab,则不处理后台返回的数据
sectionChange(index) {
this.curNow = index
this.reloadOrderList()
},
// tab栏切换
change(index) {
this.current[this.curNow] = index
this.reloadOrderList()
},
// 滚动底部
reachBottom(e) {
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.getOrderList()
},
// 页面数据
getOrderList() {
// 状态处理
this.pageNumber += 1
if (this.pageNumber == 1) {
this.loaded = false
}
var param = {
pageNumber: this.pageNumber,
pageSize: this.pageSize,
keyword: '',
type: this.orderType,
}
var self = this
self.$u.api.listOrder(param).then((res) => {
if (res.code == 200) {
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数字
) if (!this.isFinish && self.list[this.curNow][self.types[this.curNow][res.data.type]]) {
// 更新tab数字 self.list[this.curNow][self.types[this.curNow][res.data.type]].total = res.data.total;
if ( }
!this.isFinish && // 待预约, 待签到,待完工需要排序
self.list[this.curNow][self.types[this.curNow][res.data.type]] if (this.needSort) {
) { self.orderList[this.curNow][this.current[this.curNow]].sort((x, y) => {
self.list[this.curNow][ return x.currentOverTime < y.currentOverTime ? 1 : -1;
self.types[this.curNow][res.data.type] });
].total = res.data.total }
} // 更新底部加载状态
// 待预约, 待签到,待完工需要排序 self.loadStatus =
if (this.needSort) { 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]].sort( }
(x, y) => { } else {
return x.currentOverTime < y.currentOverTime ? 1 : -1 console.log(res.message, '获取订单数量失败!');
} }
) self.$nextTick(() => {
} if (self.freshing) {
// 更新底部加载状态 self.triggered = false;
self.loadStatus = self.freshing = false;
res.data.total > }
self.orderList[this.curNow][this.current[this.curNow]].length && });
res.data.list.length == self.pageSize this.loaded = true;
? 'loadmore' });
: 'nomore' },
}
} else {
console.log(res.message, '获取订单数量失败!')
}
self.$nextTick(() => {
if (self._freshing) {
self.triggered = false
self._freshing = false
}
})
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=' +
item.orderId + item.orderId +
'&categoryId=' + '&categoryId=' +
item.categoryId + item.categoryId +
'&orderServiceType=' + '&orderServiceType=' +
item.orderServiceType + item.orderServiceType +
'&inGuaranteePeriod=' + '&inGuaranteePeriod=' +
item.inGuaranteePeriod + item.inGuaranteePeriod +
'&partnerCompanyId=' + '&partnerCompanyId=' +
item.partnerCompanyId + item.partnerCompanyId +
'&maintainStep=' + '&maintainStep=' +
item.maintainStep + item.maintainStep +
'&orderStatus=' + '&orderStatus=' +
item.orderStatus + item.orderStatus +
'&brandId=' + '&brandId=' +
item.lianbaoBrandId + item.lianbaoBrandId +
'&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=' + handleClickSearch() {
type + uni.navigateTo({
'&showCountTime=' + url: 'pages/order/search'
showCountTime, });
}) },
}, onRefresh() {
handleClickSearch() { if (this.freshing) return;
uni.navigateTo({ this.freshing = true;
url: 'pages/order/search', this.reloadOrderInfo();
}) },
}, onRestore() {
onRefresh() { this.triggered = 'restore'; // 需要重置
if (this._freshing) return },
this._freshing = true reloadOrderInfo() {
this.reloadOrderInfo() this.reloadOrderList();
}, this.getOrderCount();
onRestore() { },
this.triggered = 'restore' // 需要重置 reloadOrderList() {
}, this.pageNumber = 0;
reloadOrderInfo() { this.loadStatus = 'loading';
this.reloadOrderList() this.getOrderList();
this.getOrderCount() },
}, scroll(e) {
reloadOrderList() { this.old.scrollTop = e.detail.scrollTop;
this.pageNumber = 0 },
this.loadStatus = 'loading' goTop(e) {
this.getOrderList() this.scrollTop = this.old.scrollTop;
}, this.$nextTick(function() {
scroll(e) { this.scrollTop = 0;
this.old.scrollTop = e.detail.scrollTop });
}, },
goTop(e) { // 显示提示蒙版
this.scrollTop = this.old.scrollTop showMaskTip() {
this.$nextTick(function() { this.showMask = true;
this.scrollTop = 0 }
}) }
}, };
// 显示提示蒙版
showMaskTip() {
this.showMask = true
},
},
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.u-tabs-box { .u-tabs-box {
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.tab-view { .tab-view {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
.load-more-view { .load-more-view {
padding-bottom: 44rpx; padding-bottom: 44rpx;
} }
.loading-view { .loading-view {
width: 100%; width: 100%;
background-color: transparent; background-color: transparent;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
top: 50%; top: 50%;
left: 0; left: 0;
position: fixed; position: fixed;
} }
} }
.tools-box { .tools-box {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
padding-bottom: 18rpx; padding-bottom: 18rpx;
.search-sub { .search-sub {
height: 72rpx; height: 72rpx;
width: 320rpx; width: 320rpx;
} }
.search-btn { .search-btn {
height: 72rpx; height: 72rpx;
width: 220rpx; width: 220rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 36rpx; border-radius: 36rpx;
color: #999999; color: #999999;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.search-image { .search-image {
width: 36rpx; width: 36rpx;
height: 32rpx; height: 32rpx;
flex-shrink: 0; flex-shrink: 0;
margin-right: 24rpx; margin-right: 24rpx;
} }
.search-btn-text { .search-btn-text {
line-height: 36rpx; line-height: 36rpx;
font-weight: 400; font-weight: 400;
font-size: 26rpx; font-size: 26rpx;
} }
} }
} }
</style> </style>
...@@ -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,9 +132,13 @@ export default { ...@@ -129,9 +132,13 @@ export default {
.txt { .txt {
font-size: 14px; font-size: 14px;
width: 100%; width: 100%;
overflow: hidden; .text-inner{
text-overflow: ellipsis; padding-right: 50rpx;
white-space: nowrap; width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
} }
} }
} }
......
...@@ -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
}, },
......
...@@ -3,55 +3,62 @@ ...@@ -3,55 +3,62 @@
<view class="tools-box"> <view class="tools-box">
<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">
</view> <xh-picker-select background="#f4f5f7" placeholder="全部" :rangeKey="rangeKey" :value="value" :list="brandList" @change="pickerchange"></xh-picker-select>
</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);
...@@ -76,16 +72,16 @@ export default { ...@@ -76,16 +72,16 @@ export default {
this.openDelete(); this.openDelete();
} }
}, },
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,10 +39,12 @@ export default { ...@@ -38,10 +39,12 @@ 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栏切换
change(index) { change(index) {
......
...@@ -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();
}, },
// 重置下拉状态 // 重置下拉状态
...@@ -350,4 +350,4 @@ export default { ...@@ -350,4 +350,4 @@ export default {
bottom: 64rpx; bottom: 64rpx;
} }
} }
</style> </style>
<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: {
width: '100%',
height: '80rpx',
fontSize: '32rpx',
fontWeight: 'bold'
}, },
inventoryCount: 0, signCount: 0, // 库存数量
checkCount: 0 takeCount: 0, // 当前盘点数量
takeStatusOptions: {
0: '去盘点',
1: '确认盘点',
2: '申请重盘',
3: '已完成'
}
}; };
}, },
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; this.loaded = false;
if (this.form.pageNumber == 1) { var param = this.form;
this.loaded = false; let res = await this.$u.api.inventoryListByInventoryModules(param);
}
var param = this.form
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) {
this.getDetail(); let {id,takeId}=e
this.disabled = true; this.form.takeId = takeId;
if(id){
this.form.id = id;
this.getDetail();
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;
...@@ -232,7 +230,7 @@ export default { ...@@ -232,7 +230,7 @@ export default {
.load-more-view { .load-more-view {
padding-bottom: 64rpx; padding-bottom: 64rpx;
} }
.loading-view { .loading-view {
width: 100%; width: 100%;
display: flex; display: flex;
......
<template> <template>
<view class="pg-complete"> <view class="pg-complete">
<complete-check <complete-check
:show="completeCheck.status" :show="completeCheck.status"
:list-data="completeCheck.result" :list-data="completeCheck.result"
:pass="pass" :pass="pass"
@close="closeCheckResult" @close="closeCheckResult"
@confirm="confirm" @confirm="confirm"
:confirm-button-text="completeCheck.confirmText" :confirm-button-text="completeCheck.confirmText"
:cancel-button-text="completeCheck.cancelText" :cancel-button-text="completeCheck.cancelText"
></complete-check> ></complete-check>
<view class="com-content"> <view class="com-content">
<u-navbar <u-navbar
:background="{ background: '#2272FF' }" :background="{ background: '#2272FF' }"
back-icon-color="#fff" back-icon-color="#fff"
:title-size="32" :title-size="32"
title-color="#fff" title-color="#fff"
:border-bottom="false" :border-bottom="false"
:title="list[tabIndex].panelName" :title="list[tabIndex].panelName"
title-bold title-bold
:custom-back="backGo" :custom-back="backGo"
></u-navbar> ></u-navbar>
<u-tabs <u-tabs
class="order-tabs" class="order-tabs"
ref="tabs" ref="tabs"
:current="current" :current="current"
name="panelName" name="panelName"
:list="tabList" :list="tabList"
@change="swichMenu" @change="swichMenu"
bg-color="#2272FF" bg-color="#2272FF"
inactive-color="#a6c6ff" inactive-color="#a6c6ff"
active-color="#fff" active-color="#fff"
height="80" height="80"
font-size="32" font-size="32"
></u-tabs> ></u-tabs>
<view class="u-menu-wrap"> <view class="u-menu-wrap">
<scroll-view <scroll-view
:scroll-top="scrollRightTop" :scroll-top="scrollRightTop"
style="height: 100%" style="height: 100%"
scroll-y scroll-y
scroll-with-animation scroll-with-animation
scroll-anchoring scroll-anchoring
class="right-box" class="right-box"
@scroll="rightScroll" @scroll="rightScroll"
: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="title">{{ groupItem.name }}</view>
: []" <view class="class-bd">
> <u-form-item
<view v-for="(item, itemIndex) in groupItem.items"
class="class-item" :key="itemIndex"
:id="'item' + groupIndex" label-position="top"
:key="groupIndex" :prop="item.fieldsName"
> :border-bottom="false"
<view class="title">{{ groupItem.name }}</view> v-show="checkFields(item.fieldsName) && ((readOnly && !$u.test.isEmpty(form[item.fieldsName])) || !readOnly)"
<view class="class-bd"> :id="`item${item.fieldsId}`"
<u-form-item >
v-for="(item, itemIndex) in groupItem.items" <view class="label" v-if="!hiddenTitle.includes(item.formType)">
:key="itemIndex" <image class="item-image" :src="mixingImage" v-if="item.required"></image>
label-position="top" {{ item.fieldsTitle }}
:prop="item.fieldsName" </view>
:border-bottom="false" <template v-if="item.fieldsType">
v-show=" <xh-input
checkFields(item.fieldsName) && v-if="item.formType === 'input'"
((readOnly && :groupIndex="groupIndex"
!$u.test.isEmpty(form[item.fieldsName])) || :type="item.inputType"
!readOnly) :itemIndex="itemIndex"
" :item="item"
:id="`item${item.fieldsId}`" :value="form[item.fieldsName] || ''"
> :disabled="readOnly || item.disabled || false"
<view :slotContent="item.fieldsInfo"
class="label" @value-change="fieldValueChange"
v-if="!hiddenTitle.includes(item.formType)" ></xh-input>
> <xh-multi-input
<image v-if="item.formType === 'multiinput'"
class="item-image" :groupIndex="groupIndex"
:src="mixingImage" :itemIndex="itemIndex"
v-if="item.required" :item="item"
></image> :value="form[item.fieldsName] || ''"
{{ item.fieldsTitle }} :disabled="readOnly"
</view> @value-change="fieldValueChange"
<template v-if="item.fieldsType"> ></xh-multi-input>
<xh-input <xh-radio
v-if="item.formType === 'input'" v-if="item.formType === 'radio'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
:type="item.inputType" :itemIndex="itemIndex"
:itemIndex="itemIndex" :item="item"
:item="item" :value="form[item.fieldsName] || ''"
:value="form[item.fieldsName] || ''" :disabled="readOnly || item.disabled || false"
:disabled="readOnly || item.disabled || false" @value-change="fieldValueChange"
:slotContent="item.fieldsInfo" ></xh-radio>
@value-change="fieldValueChange" <xh-checkbox
> v-if="item.formType === 'checkbox'"
</xh-input> :groupIndex="groupIndex"
<xh-multi-input :itemIndex="itemIndex"
v-if="item.formType === 'multiinput'" :item="item"
:groupIndex="groupIndex" :value="form[item.fieldsName] || ''"
:itemIndex="itemIndex" :disabled="readOnly"
:item="item" @value-change="fieldValueChange"
:value="form[item.fieldsName] || ''" ></xh-checkbox>
:disabled="readOnly" <xh-select
@value-change="fieldValueChange" v-if="item.formType === 'select'"
> :groupIndex="groupIndex"
</xh-multi-input> :itemIndex="itemIndex"
<xh-radio :item="item"
v-if="item.formType === 'radio'" :value="form[item.fieldsName] || ''"
:groupIndex="groupIndex" :disabled="readOnly"
:itemIndex="itemIndex" @value-change="fieldValueChange"
:item="item" ></xh-select>
:value="form[item.fieldsName] || ''" <xh-specifications
:disabled="readOnly || item.disabled || false" v-if="item.formType === 'select-new-page'"
@value-change="fieldValueChange" :groupIndex="groupIndex"
> :itemIndex="itemIndex"
</xh-radio> :item="item"
<xh-checkbox :value="form[item.fieldsName] || ''"
v-if="item.formType === 'checkbox'" :disabled="readOnly"
:groupIndex="groupIndex" @value-change="fieldValueChange"
:itemIndex="itemIndex" ></xh-specifications>
:item="item" <view v-if="item.formType === 'file'">
:value="form[item.fieldsName] || ''" <xh-files
:disabled="readOnly" :ref="`fileChild${groupIndex}${itemIndex}`"
@value-change="fieldValueChange" :groupIndex="groupIndex"
> :itemIndex="itemIndex"
</xh-checkbox> :item="item"
<xh-select :partnerCompanyId="partnerCompanyId"
v-if="item.formType === 'select'" :categoryId="categoryId"
:groupIndex="groupIndex" :value="form[item.fieldsName] || []"
:itemIndex="itemIndex" :disabled="readOnly"
:item="item" @value-change="fieldValueChange"
:value="form[item.fieldsName] || ''" >
:disabled="readOnly" <template v-slot>
@value-change="fieldValueChange" <view class="img-list" v-if="!readOnly">
> <u-image
</xh-select> class="pic"
<xh-specifications width="160rpx"
v-if="item.formType === 'select-new-page'" height="160rpx"
:groupIndex="groupIndex" :border-radius="10"
:itemIndex="itemIndex" @click="selectUpload(JSON.stringify(item), groupIndex, itemIndex)"
:item="item" :src="uploadImage"
:value="form[item.fieldsName] || ''" ></u-image>
:disabled="readOnly" </view>
@value-change="fieldValueChange" </template>
> </xh-files>
</xh-specifications> </view>
<view v-if="item.formType === 'file'">
<xh-files
:ref="`fileChild${groupIndex}${itemIndex}`"
:groupIndex="groupIndex"
:itemIndex="itemIndex"
:item="item"
:partnerCompanyId="partnerCompanyId"
:categoryId="categoryId"
:value="form[item.fieldsName] || []"
:disabled="readOnly"
@value-change="fieldValueChange"
>
<template v-slot>
<view class="img-list" v-if="!readOnly">
<u-image
class="pic"
width="160rpx"
height="160rpx"
:border-radius="10"
@click="
selectUpload(
JSON.stringify(item),
groupIndex,
itemIndex
)
"
:src="uploadImage"
></u-image>
</view>
</template>
</xh-files>
</view>
<xh-location <xh-location
v-if="item.formType === 'location'" v-if="item.formType === 'location'"
:groupIndex="groupIndex" :groupIndex="groupIndex"
:itemIndex="itemIndex" :itemIndex="itemIndex"
:item="item" :item="item"
: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" :itemIndex="itemIndex"
:itemIndex="itemIndex" :item="item"
:item="item" :value="form[item.fieldsName] || ''"
:value="form[item.fieldsName] || ''" :disabled="readOnly"
:disabled="readOnly" @value-change="fieldValueChange"
@value-change="fieldValueChange" ></xh-scan>
> <xh-service-measure
</xh-scan> v-if="item.formType === 'servicemeasure'"
<xh-service-measure :groupIndex="groupIndex"
v-if="item.formType === 'servicemeasure'" :itemIndex="itemIndex"
:groupIndex="groupIndex" :item="item"
:itemIndex="itemIndex" :orderId="orderId"
:item="item" :categoryId="categoryId"
:orderId="orderId" :orderServiceType="orderServiceType"
:categoryId="categoryId" :specificationId="form['specificationId'] || 0"
:orderServiceType="orderServiceType" :value="form[item.fieldsName]"
:specificationId="form['specificationId'] || 0" :disabled="readOnly"
:value="form[item.fieldsName]" @value-change="fieldValueChange"
:disabled="readOnly" ></xh-service-measure>
@value-change="fieldValueChange" <xh-time
> v-if="item.formType === 'time'"
</xh-service-measure> :groupIndex="groupIndex"
<xh-time :itemIndex="itemIndex"
v-if="item.formType === 'time'" :item="item"
:groupIndex="groupIndex" :value="form[item.fieldsName] || ''"
:itemIndex="itemIndex" :disabled="readOnly"
:item="item" @value-change="fieldValueChange"
:value="form[item.fieldsName] || ''" ></xh-time>
:disabled="readOnly" <xh-service-more
@value-change="fieldValueChange" v-if="item.formType === 'form'"
> :groupIndex="groupIndex"
</xh-time> :itemIndex="itemIndex"
<xh-service-more :item="item"
v-if="item.formType === 'form'" :order-id="orderId"
:groupIndex="groupIndex" :value="form[item.fieldsName] || ''"
:itemIndex="itemIndex" :disabled="readOnly"
:item="item" @value-change="fieldValueChange"
:order-id="orderId" ></xh-service-more>
:value="form[item.fieldsName] || ''" <xh-label
:disabled="readOnly" v-if="item.formType === 'label'"
@value-change="fieldValueChange" :groupIndex="groupIndex"
> :itemIndex="itemIndex"
</xh-service-more> :item="item"
<xh-label :value="form[item.fieldsName] || ''"
v-if="item.formType === 'label'" ></xh-label>
:groupIndex="groupIndex" <xh-parts
:itemIndex="itemIndex" ref="fileChildParts"
:item="item" v-if="item.formType === 'parts'"
:value="form[item.fieldsName] || ''" :categoryId="categoryId"
> :brandId="brandId"
</xh-label> :order-id="orderId"
<xh-parts :orderNumber="orderNumber"
ref="fileChildParts" :groupIndex="groupIndex"
v-if="item.formType === 'parts'" :itemIndex="itemIndex"
:categoryId="categoryId" :item="item"
:brandId="brandId" :value="form[item.fieldsName] || ''"
:order-id="orderId" :disabled="readOnly"
:orderNumber="orderNumber" :maintainStep="list[tabIndex].panelFieldsName"
:groupIndex="groupIndex" @value-change="fieldValueChange"
:itemIndex="itemIndex" ></xh-parts>
:item="item" </template>
:value="form[item.fieldsName] || ''" </u-form-item>
:disabled="readOnly" </view>
:maintainStep="list[tabIndex].panelFieldsName" </view>
@value-change="fieldValueChange" </template>
> </u-form>
</xh-parts> </scroll-view>
</template> </view>
</u-form-item> <view :class="['btn-wrap', 'flex-xc', { 'btn-bottom': tabIndex > 0, 'read-only': readOnly }]">
</view> <u-button
</view> class="btn-submit"
</template> v-if="!readOnly"
</u-form> @click="saveComplete"
</scroll-view> type="primary"
</view> shape="circle"
<view :custom-style="customStyle"
:class="[ :hover-class="submitStatus ? '' : 'none'"
'btn-wrap', >
'flex-xc', 暂存
{ 'btn-bottom': tabIndex > 0, 'read-only': readOnly }, </u-button>
]" <u-button class="btn-submit" @click="nextStep" :custom-style="buttonStyle" type="primary" shape="circle" :hover-class="submitStatus ? '' : 'none'">
> {{ tabIndex === list.length - 1 ? (readOnly ? '返回列表' : '提交') : readOnly ? '查看下一步' : '下一步' }}
<u-button </u-button>
class="btn-submit" </view>
v-if="!readOnly" </view>
@click="saveComplete" <u-toast ref="uToast" />
type="primary" <take-photo v-if="takeStatus" @close="closeTake" :upload="false" :currentItem="currentItemDate"></take-photo>
shape="circle" <u-action-sheet :list="carmeraList" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet>
:custom-style="customStyle" <upload-progress />
:hover-class="submitStatus ? '' : 'none'" </view>
>
暂存
</u-button>
<u-button
class="btn-submit"
@click="nextStep"
:custom-style="buttonStyle"
type="primary"
shape="circle"
:hover-class="submitStatus ? '' : 'none'"
>
{{
tabIndex === list.length - 1
? readOnly
? '返回列表'
: '提交'
: readOnly
? '查看下一步'
: '下一步'
}}
</u-button>
</view>
</view>
<u-toast ref="uToast" />
<take-photo
v-if="takeStatus"
@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 />
</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([
['text', ['input', 'textarea']], ['text', ['input', 'textarea']],
['password', ['password', 'input']], ['password', ['password', 'input']],
['textarea', ['input', 'digit']], ['textarea', ['input', 'digit']],
['number', ['input', 'digit']], ['number', ['input', 'digit']],
['decimal', ['input', 'digit']], ['decimal', ['input', 'digit']],
['double', ['input', 'digit']], ['double', ['input', 'digit']],
['integer', ['input', 'digit']], ['integer', ['input', 'digit']],
['string', ['input', 'text']], ['string', ['input', 'text']],
['jscode', ['input', 'text']], ['jscode', ['input', 'text']],
['multiinput', ['multiinput', 'text']], ['multiinput', ['multiinput', 'text']],
['select', ['select', 'text']], ['select', ['select', 'text']],
['specifications', ['select-new-page', 'text']], ['specifications', ['select-new-page', 'text']],
['radio', ['radio', 'text']], ['radio', ['radio', 'text']],
['checkbox', ['checkbox', 'text']], ['checkbox', ['checkbox', 'text']],
['file', ['file', 'text']], ['file', ['file', 'text']],
['photos', ['file', 'text']], ['photos', ['file', 'text']],
['location', ['location', 'text']], ['location', ['location', 'text']],
['scan', ['scan', 'text']], ['scan', ['scan', 'text']],
['machine_code', ['scan', 'text']], ['machine_code', ['scan', 'text']],
['service_measures', ['servicemeasure', 'text']], ['service_measures', ['servicemeasure', 'text']],
['time', ['time', 'text']], ['time', ['time', 'text']],
['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 弹窗校验
...@@ -375,1113 +305,1071 @@ const formType = new Map([ ...@@ -375,1113 +305,1071 @@ const formType = new Map([
* @property {submit} submit 提交或下一步 * @property {submit} submit 提交或下一步
*/ */
const actions = (name, pass, type, submit) => { 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' } else if (name === 'partnerInstallItem') {
? handerProgrom.next // 安装
: handerProgrom.appointment let hander = '';
: handerProgrom.perfect switch (type) {
} else if (name === 'partnerInstallItem') { case '01': // 安装完成
// 安装 hander = !pass ? handerProgrom.perfect : handerProgrom.next;
let hander = '' break;
switch (type) { case '02': // 二次安装
case '01': // 安装完成 hander = !pass ? handerProgrom.noPerfectSubmit : handerProgrom.appointment;
hander = !pass ? handerProgrom.perfect : handerProgrom.next break;
break case '03': //不安装
case '02': // 二次安装 hander = handerProgrom.confirm;
hander = !pass break;
? handerProgrom.noPerfectSubmit default:
: handerProgrom.appointment hander = handerProgrom.perfect;
break break;
case '03': //不安装 }
hander = handerProgrom.confirm return hander;
break } else {
default: // 基础信息
hander = handerProgrom.perfect if (!pass) return handerProgrom.perfect;
break return submit ? handerProgrom.submit : handerProgrom.next;
} }
return hander };
} else {
// 基础信息
if (!pass) return handerProgrom.perfect
return submit ? handerProgrom.submit : handerProgrom.next
}
}
const fields = { const fields = {
'paymentMethodsType': { // 基本信息-不需要收款 paymentMethodsType: {
fieldsName: ['actualPaid', 'eSerialNum'], // 基本信息-不需要收款
value: '03' fieldsName: ['actualPaid', 'eSerialNum'],
}, value: '03'
'usePart': { // 维修工单-是否使用配件 },
fieldsName: ['partName'], usePart: {
value: '02' // 维修工单-是否使用配件
}, fieldsName: ['partName'],
'getMoney': { // 维修工单-是否收款 value: '02'
fieldsName: ['feeValue', 'feeProject'], },
value: '02' getMoney: {
} // 维修工单-是否收款
} fieldsName: ['feeValue', 'feeProject'],
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() {
return { return {
hiddenTitle: ['location', 'form', 'label', 'parts'], hiddenTitle: ['location', 'form', 'label', 'parts'],
orderId: 0, orderId: 0,
categoryId: 0, categoryId: 0,
brandId: 0, brandId: 0,
orderNumber: '', orderNumber: '',
orderServiceType: '', orderServiceType: '',
inGuaranteePeriod: '', inGuaranteePeriod: '',
partnerCompanyId: '', partnerCompanyId: '',
auditResults: [], auditResults: [],
list: [], list: [],
tabIndex: 0, tabIndex: 0,
scrollTop: 0, //tab标题的滚动条位置 scrollTop: 0, //tab标题的滚动条位置
oldScrollTop: 0, oldScrollTop: 0,
current: 0, // 预设当前项的值 current: 0, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度 menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度 menuItemHeight: 0, // 左边菜单item的高度
itemId: '', // 栏目右边scroll-view用于滚动的id itemId: '', // 栏目右边scroll-view用于滚动的id
oldItemId: '', oldItemId: '',
menuItemPos: [], menuItemPos: [],
arr: [], arr: [],
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度 scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
timer: null, // 定时器 timer: null, // 定时器
form: {}, form: {},
submitBtnStatus: false, submitBtnStatus: false,
completeCheck: { completeCheck: {
status: false, status: false,
resulut: [], resulut: [],
confirmText: '去完善', confirmText: '去完善',
cancelText: '', cancelText: '',
action: '', action: '',
cancelAction: '', cancelAction: ''
}, },
waitHandlerPanelIndex: 0, waitHandlerPanelIndex: 0,
waitHandlerGroupIndex: 0, waitHandlerGroupIndex: 0,
waitHandlerEleIndex: 0, waitHandlerEleIndex: 0,
pass: false, pass: false,
// 上传组件相关 // 上传组件相关
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,
XhMultiInput, XhMultiInput,
XhRadio, XhRadio,
XhCheckbox, XhCheckbox,
XhSelect, XhSelect,
XhSpecifications, XhSpecifications,
XhFiles, XhFiles,
XhLocation, XhLocation,
XhScan, XhScan,
XhTime, XhTime,
XhServiceMeasure, XhServiceMeasure,
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() {
}, //console.log(this.form.name, 'form.name')
updated() { },
//console.log(this.form.name, 'form.name') computed: {
}, exception() {
computed: { return this.orderStatus == '86';
exception() { },
return this.orderStatus == '86' readOnly() {
}, return [80, 81, 83, 85, 87, 89, 88, 110].indexOf(Number(this.orderStatus)) != -1;
readOnly() { },
return ( tabList() {
[80, 81, 83, 85, 87, 89, 88, 110].indexOf(Number(this.orderStatus)) != // 没有数据的时候tab要有占位数据,不然有页面有晃动
-1 return this.list.length > 0 ? this.list[this.tabIndex].items : [{ name: '' }];
) },
}, mixingImage() {
tabList() { return process.uniEnv.qn_base_url + 'mixing.png';
// 没有数据的时候tab要有占位数据,不然有页面有晃动 },
return this.list.length > 0 uploadImage() {
? this.list[this.tabIndex].items return process.uniEnv.qn_base_url + 'upload-file.png';
: [{ name: '' }] },
}, buttonStyle() {
mixingImage() { return {
return process.uniEnv.qn_base_url + 'mixing.png' color: '#FFFFFF',
}, 'background-color': '#2272FF;',
uploadImage() { width: '300rpx',
return process.uniEnv.qn_base_url + 'upload-file.png' height: '104rpx',
}, 'font-size': '32rpx',
buttonStyle() { 'font-weight': 'bold',
return { 'margin-left': '50rpx'
color: '#FFFFFF', };
'background-color': '#2272FF;', },
width: '300rpx', customStyle() {
height: '104rpx', return {
'font-size': '32rpx', 'background-color': '#D1D4D4',
'font-weight': 'bold', width: '300rpx',
'margin-left': '50rpx', height: '104rpx',
} 'background-color': 'transparent',
}, border: '1px solid #2272FF',
customStyle() { color: '#2272FF',
return { 'font-weight': 'bold',
'background-color': '#D1D4D4', 'font-size': '32rpx'
width: '300rpx', };
height: '104rpx', },
'background-color': 'transparent', show200() {
border: '1px solid #2272FF', return this.form.paymentMethodsType && this.form.paymentMethodsType != '03';
color: '#2272FF', },
'font-weight': 'bold', // 从订单管理和浏览记录进来,不跳转到订单列表,而是后退到订单管理和浏览记录
'font-size': '32rpx', completeBack() {
} let pages = getCurrentPages();
}, var i = 0;
show200() { for (var item of pages) {
return ( if (['/pages/mine/history/index', '/pages/mine/order/index'].indexOf(item.$page?.fullPath.split('?')[0]) != -1) {
this.form.paymentMethodsType && this.form.paymentMethodsType != '03' return pages.length - i - 1;
) }
}, i++;
// 从订单管理和浏览记录进来,不跳转到订单列表,而是后退到订单管理和浏览记录 }
completeBack() { return 0;
let pages = getCurrentPages() }
var i = 0 },
for (var item of pages) { methods: {
if ( checkFields(name) {
['/pages/mine/history/index', '/pages/mine/order/index'].indexOf( let status = true;
item.$page?.fullPath.split('?')[0] if (fieldsNameArr.includes(name)) {
) != -1 Object.entries(fields).forEach(v => {
) { if (v[1].fieldsName.includes(name)) {
return pages.length - i - 1 status = this.form[v[0]] ? this.form[v[0]] !== v[1].value : false;
} }
i++ });
} }
return 0 return status;
}, },
}, getCompleteData() {
methods: { //获取工单配置的完工项目
checkFields(name) { uni.showLoading({
let status = true title: '加载中'
if (fieldsNameArr.includes(name)) { });
Object.entries(fields).forEach(v => { if (this.orderId) {
if (v[1].fieldsName.includes(name)) { this.$u.api.getCompleteConfigAndData(this.orderId).then(res => {
status = this.form[v[0]] ? this.form[v[0]] !== v[1].value : false if (res.code == 200) {
} this.initData(res);
}) } else {
} this.$refs.uToast.show({
return status title: res.message || res.data,
}, type: 'error'
getCompleteData() { });
//获取工单配置的完工项目 }
uni.showLoading({ });
title: '加载中', }
}) },
if (this.orderId) { initData(res) {
this.$u.api.getCompleteConfigAndData(this.orderId).then((res) => { this.form = res.data.value || {};
if (res.code == 200) { this.loadOrderDetail();
this.initData(res) const data = Object.create(res.data.config, {});
} else { const list = data.sort((a, b) => a.order - b.order);
this.$refs.uToast.show({ if (this.readOnly) this.tabIndex = 0;
title: res.message || res.data,
type: 'error',
})
}
})
}
},
initData(res) {
this.form = res.data.value || {}
this.loadOrderDetail()
const data = Object.create(res.data.config, {})
const list = data.sort((a, b) => a.order - b.order)
if (this.readOnly) this.tabIndex = 0
list.forEach((item, index) => {
if (this.maintainStep === item.panelFieldsName && !this.readOnly) {
this.tabIndex = index
}
item.items.forEach((v) => {
v.items.forEach((d) => {
const type = d.fieldsType.toLocaleLowerCase()
const formMap = formType.get(type) || formType.get('text')
d.formType = formMap[0]
d.inputType = formMap[1]
if (fieldsNameArr.includes(d.fieldsName)) {
d.required = this.checkFields(d.fieldsName)
}
if (d.fieldsName === 'pipe' || d.fieldsName === 'pipeUseLength') { list.forEach((item, index) => {
// 申请费用计算 if (this.maintainStep === item.panelFieldsName && !this.readOnly) {
this.calcMoney() this.tabIndex = index;
} }
item.items.forEach(v => {
v.items.forEach(d => {
const type = d.fieldsType.toLocaleLowerCase();
const formMap = formType.get(type) || formType.get('text');
d.formType = formMap[0];
d.inputType = formMap[1];
if (fieldsNameArr.includes(d.fieldsName)) {
d.required = this.checkFields(d.fieldsName);
}
if (d.fieldsName === 'materialList') { if (d.fieldsName === 'pipe' || d.fieldsName === 'pipeUseLength') {
d.subtitle = '(必填项)' // 申请费用计算
} this.calcMoney();
if (d.fieldsName === 'craftList') { }
d.subtitle = '(若有增项,则为必填项)'
}
})
})
})
// this.showTab = this.list.length > 1 if (d.fieldsName === 'materialList') {
// 异常单处理 d.subtitle = '(必填项)';
if (this.exception) { }
if (this.auditResults.length === 0) { if (d.fieldsName === 'craftList') {
this.$refs.uToast.show({ d.subtitle = '(若有增项,则为必填项)';
title: '未找到不通过项', }
type: 'error', });
back: true, });
}) });
}
this.checkCompleteError(list)
} else {
this.list = Object.freeze(list)
}
uni.hideLoading()
},
loadOrderDetail() {
if (
!this.$u.test.isEmpty(this.form) &&
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 (!this.$u.test.isEmpty(res.data.checkInDateTime)) {
this.$set(
this.form,
'installComfirmTime',
this.moment(res.data.checkInDateTime).format('YYYY-MM-DD')
)
}
}
})
}
},
checkCompleteError(list) {
// 异常单定位错误项
let errArr = []
list.forEach((panel, panelIndex) => {
panel.items.forEach((group, groupIndex) => {
group.items.forEach((ele, eleIndex) => {
if (this.auditResults.includes(ele.fieldsName)) {
const errGroup = {
componentType: group.componentType,
name: group.name,
items: ele,
}
if (ele.fieldsName === 'orderSpareParts') {
const index = errArr.findIndex(v => v.name === '备件信息' || v.name === '物料信息')
if (index > -1) return
}
errArr.push(errGroup)
}
})
})
})
// 图片分组
const result = errArr.reduce((groups, item) => {
let groupFound = groups.find((arrItem) => item.name === arrItem.name)
if (groupFound) {
groupFound.componentType = item.componentType
if (groupFound.items.indexOf(item.items) == -1) {
//去重
groupFound.items.push(item.items)
}
} else {
//不要直接在原来的对象修改,新建对象
let newGroup = {
name: item.name,
componentType: item.componentType,
items: [item.items],
}
groups.push(newGroup)
}
return groups
}, [])
let index = list.length++ // this.showTab = this.list.length > 1
list[index] = { // 异常单处理
order: index + 1, if (this.exception) {
panelFieldsName: 'error', if (this.auditResults.length === 0) {
panelName: '异常处理', this.$refs.uToast.show({
items: result, title: '未找到不通过项',
} type: 'error',
this.list = Object.freeze(list) back: true
this.tabIndex = index });
}, }
this.checkCompleteError(list);
} else {
this.list = Object.freeze(list);
}
uni.hideLoading();
},
loadOrderDetail() {
if (!this.$u.test.isEmpty(this.form) && 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 (!this.$u.test.isEmpty(res.data.checkInDateTime)) {
this.$set(this.form, 'installComfirmTime', this.moment(res.data.checkInDateTime).format('YYYY-MM-DD'));
}
}
});
}
},
checkCompleteError(list) {
// 异常单定位错误项
let errArr = [];
list.forEach((panel, panelIndex) => {
panel.items.forEach((group, groupIndex) => {
group.items.forEach((ele, eleIndex) => {
if (this.auditResults.includes(ele.fieldsName)) {
const errGroup = {
componentType: group.componentType,
name: group.name,
items: ele
};
if (ele.fieldsName === 'orderSpareParts') {
const index = errArr.findIndex(v => v.name === '备件信息' || v.name === '物料信息');
if (index > -1) return;
}
errArr.push(errGroup);
}
});
});
});
// 图片分组
const result = errArr.reduce((groups, item) => {
let groupFound = groups.find(arrItem => item.name === arrItem.name);
if (groupFound) {
groupFound.componentType = item.componentType;
if (groupFound.items.indexOf(item.items) == -1) {
//去重
groupFound.items.push(item.items);
}
} else {
//不要直接在原来的对象修改,新建对象
let newGroup = {
name: item.name,
componentType: item.componentType,
items: [item.items]
};
groups.push(newGroup);
}
return groups;
}, []);
handleSaveData() { let index = list.length++;
let param = {} list[index] = {
const name = this.list[this.tabIndex].panelFieldsName order: index + 1,
this.list.forEach((panel) => { panelFieldsName: 'error',
param[panel.panelFieldsName] = [] panelName: '异常处理',
panel.items.forEach((group) => { items: result
group.items.forEach((ele) => { };
if (name === 'partnerInspectItem') { this.list = Object.freeze(list);
if (!this.form?.installationMethodType) { this.tabIndex = index;
this.$set( },
this.form,
'installationMethodType',
this.form.installType
)
}
}
if (this.form[ele.fieldsName]) {
param[panel.panelFieldsName].push({
fieldsName: ele.fieldsName,
fieldsType: ele.fieldsType,
fieldsValue: this.form[ele.fieldsName],
required: ele.required,
})
}
})
})
})
return param
},
saveComplete() {
// 保存完工信息
// this.submitParts() // 不调这个接口;没完工不能调提交配件
const param = this.handleSaveData()
this.$u.api.saveCompleteData(param, this.orderId).then((res) => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '保存成功',
type: 'success',
})
} else {
this.$refs.uToast.show({
title: res.data || res.message,
type: 'error',
})
}
})
},
checkCompleteItem() {
let checkResult = []
let pass = true
let first = true
const lists = this.tabList
console.log("lists", lists)
lists.forEach((group, groupIndex) => {
const checkRequired = group.items.some((v) => v.required)
if (checkRequired) {
let panelResult = {
label: group.name,
submitted: 0,
required: 0,
pass: true,
}
group.items.forEach((ele, eleIndex) => {
if (ele.fieldsType == 'PARTS') {
console.log("ele", ele)
}
if (ele.required) {
panelResult.required++
let value = this.form[ele.fieldsName]
// "ele.fieldsName != 'eSerialNum' || value.length == 8" 意思是: "非付款流水号 || 8位付款流水号"
if (value && !Array.isArray(value) && (ele.fieldsName != 'eSerialNum' || value.length == 8)) {
panelResult.submitted++
} else if (value && Array.isArray(value) && value.length > 0) {
if (ele.fieldsName === 'materialList') {
let hasMate = false
let mateRow = value.find((mate) => {
if (mate.hasOwnProperty('useLength')) {
hasMate = true
return !this.$u.test.isEmpty(mate.useLength)
}
})
if (!hasMate || !this.$u.test.isEmpty(mateRow)) {
panelResult.submitted++
}
} else {
panelResult.submitted++
}
} else if (first) {
// 记录第一个 为空 并且需要必填的项 用于定位
first = false
this.waitHandlerPanelIndex = this.tabIndex
this.waitHandlerGroupIndex = groupIndex
this.waitHandlerEleIndex = eleIndex
this.oldItemId = `item${ele.fieldsId}`
}
}
})
panelResult.pass = panelResult.required <= panelResult.submitted
pass = pass && panelResult.pass
checkResult.push(panelResult)
}
})
this.completeCheck.result = checkResult handleSaveData() {
return pass let param = {};
}, const name = this.list[this.tabIndex].panelFieldsName;
closeResult() { this.list.forEach(panel => {
param[panel.panelFieldsName] = [];
}, panel.items.forEach(group => {
// 检查结果窗口取消回调 group.items.forEach(ele => {
closeCheckResult() { if (name === 'partnerInspectItem') {
this.completeCheck.status = false if (!this.form?.installationMethodType) {
this[this.completeCheck.cancelAction]() this.$set(this.form, 'installationMethodType', this.form.installType);
}, }
// 检查结果窗口 确认回调 }
confirm() { if (this.form[ele.fieldsName]) {
this.completeCheck.status = false param[panel.panelFieldsName].push({
this[this.completeCheck.action]() fieldsName: ele.fieldsName,
}, fieldsType: ele.fieldsType,
// 去完善 fieldsValue: this.form[ele.fieldsName],
handerProgrom() { required: ele.required
this.locationCompleteItem( });
this.waitHandlerPanelIndex, }
this.waitHandlerGroupIndex, });
this.waitHandlerEleIndex });
) });
}, return param;
// 去预约 },
async appointment() { saveComplete() {
const save = await this.nextStepSaveData() // 保存完工信息
if (save) { // this.submitParts() // 不调这个接口;没完工不能调提交配件
if (this.completeBack) { const param = this.handleSaveData();
// 从订单管理和浏览记录进来 this.$u.api.saveCompleteData(param, this.orderId).then(res => {
uni.navigateBack({ let { code, data, message } = res;
delta: this.completeBack, if (code == 200) {
}) this.$refs.uToast.show({
} else { title: '保存成功',
uni.reLaunch({ type: 'success'
url: '/pages/index/order?type=waitAppointment', });
}) } else {
} let msg = '';
} if (data && data instanceof string) {
}, msg = data;
// 下一步动作 } else {
async nextAction() { msg = message;
const save = await this.nextStepSaveData() }
if (save) { this.$refs.uToast.show({
this.nextTab() title: msg,
} type: 'error'
}, });
nextTab() { }
if (this.tabIndex < this.list.length - 1) { });
this.tabIndex++ },
this.arr = [] checkCompleteItem() {
this.scrollRightTop = 0 let checkResult = [];
this.current = 0 let pass = true;
//this.itemId = '' let first = true;
//const itemId = this.list[this.tabIndex].items[0].items[0].fieldsId const lists = this.tabList;
//this.oldItemId = `item${itemId}` console.log('lists', lists);
this.$nextTick(async () => { lists.forEach((group, groupIndex) => {
await this.swichMenu(0) const checkRequired = group.items.some(v => v.required);
}) if (checkRequired) {
} let panelResult = {
}, label: group.name,
submitted: 0,
required: 0,
pass: true
};
group.items.forEach((ele, eleIndex) => {
if (ele.fieldsType == 'PARTS') {
console.log('ele', ele);
}
if (ele.required) {
panelResult.required++;
let value = this.form[ele.fieldsName];
// "ele.fieldsName != 'eSerialNum' || value.length == 8" 意思是: "非付款流水号 || 8位付款流水号"
if (value && !Array.isArray(value) && (ele.fieldsName != 'eSerialNum' || value.length == 8)) {
panelResult.submitted++;
} else if (value && Array.isArray(value) && value.length > 0) {
if (ele.fieldsName === 'materialList') {
let hasMate = false;
let mateRow = value.find(mate => {
if (mate.hasOwnProperty('useLength')) {
hasMate = true;
return !this.$u.test.isEmpty(mate.useLength);
}
});
if (!hasMate || !this.$u.test.isEmpty(mateRow)) {
panelResult.submitted++;
}
} else {
panelResult.submitted++;
}
} else if (first) {
// 记录第一个 为空 并且需要必填的项 用于定位
first = false;
this.waitHandlerPanelIndex = this.tabIndex;
this.waitHandlerGroupIndex = groupIndex;
this.waitHandlerEleIndex = eleIndex;
this.oldItemId = `item${ele.fieldsId}`;
}
}
});
panelResult.pass = panelResult.required <= panelResult.submitted;
pass = pass && panelResult.pass;
checkResult.push(panelResult);
}
});
// 下一步弹窗处理 this.completeCheck.result = checkResult;
nextStep() { return pass;
if (this.readOnly) { },
if (this.tabIndex === this.list.length - 1) { closeResult() {},
uni.navigateBack() // 检查结果窗口取消回调
} else { closeCheckResult() {
this.nextTab() this.completeCheck.status = false;
} this[this.completeCheck.cancelAction]();
return },
} // 检查结果窗口 确认回调
this.pass = this.checkCompleteItem() confirm() {
this.completeCheck.status = false;
this[this.completeCheck.action]();
},
// 去完善
handerProgrom() {
this.locationCompleteItem(this.waitHandlerPanelIndex, this.waitHandlerGroupIndex, this.waitHandlerEleIndex);
},
// 去预约
async appointment() {
const save = await this.nextStepSaveData();
if (save) {
if (this.completeBack) {
// 从订单管理和浏览记录进来
uni.navigateBack({
delta: this.completeBack
});
} else {
uni.reLaunch({
url: '/pages/index/order?type=waitAppointment'
});
}
}
},
// 下一步动作
async nextAction() {
const save = await this.nextStepSaveData();
if (save) {
this.nextTab();
}
},
nextTab() {
if (this.tabIndex < this.list.length - 1) {
this.tabIndex++;
this.arr = [];
this.scrollRightTop = 0;
this.current = 0;
//this.itemId = ''
//const itemId = this.list[this.tabIndex].items[0].items[0].fieldsId
//this.oldItemId = `item${itemId}`
this.$nextTick(async () => {
await this.swichMenu(0);
});
}
},
const name = this.list[this.tabIndex].panelFieldsName // 下一步弹窗处理
const type = nextStep() {
name === 'partnerInspectItem' if (this.readOnly) {
? this.form.inspectConclusionType if (this.tabIndex === this.list.length - 1) {
: this.form.constructionConclusionType uni.navigateBack();
const submit = this.tabIndex === this.list.length - 1 } else {
const result = actions(name, this.pass, type, submit) this.nextTab();
}
return;
}
this.pass = this.checkCompleteItem();
this.completeCheck.status = true const name = this.list[this.tabIndex].panelFieldsName;
this.completeCheck.confirmText = result.confirmText const type = name === 'partnerInspectItem' ? this.form.inspectConclusionType : this.form.constructionConclusionType;
this.completeCheck.action = result.action const submit = this.tabIndex === this.list.length - 1;
this.completeCheck.cancelText = result.cancelText || '' const result = actions(name, this.pass, type, submit);
this.completeCheck.cancelAction = result.cancelAction || ''
},
// 下一步数据保存
nextStepSaveData() {
const params = {
maintainFields: this.handleSaveData(),
currentStep: this.list[this.tabIndex].panelFieldsName,
nextStep: this.list[this.tabIndex + 1].panelFieldsName,
version: 2,
}
uni.showLoading({
title: '加载中',
})
return this.$u.api.completeNextStep(params, this.orderId).then((res) => {
uni.hideLoading()
if (res.code == 200) {
return Promise.resolve(true)
} else {
this.$refs.uToast.show({
title: res.message || res.data,
type: 'error',
})
return Promise.resolve(false)
}
})
},
locationCompleteItem(panelIndex, groupIndex, eleIndex) {
// 页面定位到某一项
this.tabIndex = panelIndex
this.current = groupIndex
this.itemId = ''
this.$nextTick(function() {
if (this.oldItemId) this.itemId = this.oldItemId
})
},
// 提交配件信息
submitParts() {
return new Promise((resolve, reject) => {
if (this.form.orderSpareParts) {
const orderSpareParts = JSON.parse(this.form.orderSpareParts)
const lists = orderSpareParts.filter((v) => v.quantity > 0)
const params = {
workOrderId: this.orderId,
applyType: '10',
parts: lists ? JSON.stringify(lists) : '',
}
this.$u.api.createParts(params).then((res) => {
if (res.code !== 200) {
this.$refs.uToast.show({
title: res.data,
type: 'error',
})
resolve(false)
}
resolve(true)
})
} else {
resolve(true)
}
})
},
// 提交订单
orderFinish() {
const param = this.handleSaveData()
// 完工事件埋点
getApp().track('order_finish', {
id: this.vuex_user.id,
mobile: this.vuex_user.mobile,
orderId: Number(this.orderId),
})
this.$u.api.saveCompleteData(param, this.orderId).then(async (res) => {
if (res.code == 200) {
//完工项信息保存成功再次完工工单
// if (!this.exception) { // 核销配件
// const submitPart = await this.submitParts()
// if (!submitPart) return
// }
if (this.inGuaranteePeriod === 'Y') { this.completeCheck.status = true;
this.$u.api.inOrderFinish(this.orderId).then((res) => { this.completeCheck.confirmText = result.confirmText;
if (res.code == 200) { this.completeCheck.action = result.action;
this.successTips() this.completeCheck.cancelText = result.cancelText || '';
} else { this.completeCheck.cancelAction = result.cancelAction || '';
this.$refs.uToast.show({ },
title: res.data, // 下一步数据保存
type: 'error', nextStepSaveData() {
}) const params = {
} maintainFields: this.handleSaveData(),
}) currentStep: this.list[this.tabIndex].panelFieldsName,
} else { nextStep: this.list[this.tabIndex + 1].panelFieldsName,
this.$u.api version: 2
.outOrderFinish({ customerPayType: 'CASH' }, this.orderId) };
.then((res) => { uni.showLoading({
if (res.code == 200) { title: '加载中'
this.successTips() });
} else { return this.$u.api.completeNextStep(params, this.orderId).then(res => {
this.$refs.uToast.show({ uni.hideLoading();
title: res.data, if (res.code == 200) {
type: 'error', return Promise.resolve(true);
}) } else {
} this.$refs.uToast.show({
}) title: res.message || res.data,
} type: 'error'
} else { });
this.$refs.uToast.show({ return Promise.resolve(false);
title: res.message, }
type: 'error', });
}) },
} locationCompleteItem(panelIndex, groupIndex, eleIndex) {
}) // 页面定位到某一项
}, this.tabIndex = panelIndex;
// 提交成功后续 this.current = groupIndex;
successTips() { this.itemId = '';
uni.showModal({ this.$nextTick(function() {
title: '提交成功', if (this.oldItemId) this.itemId = this.oldItemId;
content: '是否查看本单服务质量详情?', });
confirmText: '好的', },
cancelText: '算了', // 提交配件信息
success: res => { submitParts() {
if (res.confirm) { return new Promise((resolve, reject) => {
uni.reLaunch({ if (this.form.orderSpareParts) {
url: `/pages/order/quality?id=${this.orderId}`, const orderSpareParts = JSON.parse(this.form.orderSpareParts);
}) const lists = orderSpareParts.filter(v => v.quantity > 0);
} else if (res.cancel) { const params = {
if (this.completeBack) { workOrderId: this.orderId,
// 从订单管理和浏览记录进来 applyType: '10',
uni.navigateBack({ parts: lists ? JSON.stringify(lists) : ''
delta: this.completeBack, };
}) this.$u.api.createParts(params).then(res => {
} else { if (res.code !== 200) {
uni.reLaunch({ this.$refs.uToast.show({
url: '/pages/index/order?type=audit', title: res.data,
}) type: 'error'
} });
} resolve(false);
} }
}) resolve(true);
}, });
calMaterialCraftListAmount(arr) { } else {
let amount = 0 resolve(true);
if (arr) { }
arr.forEach((item) => { });
let useLength = },
(item.hasOwnProperty('useLength') && Number(item.useLength)) || 0 // 提交订单
let freeLength = orderFinish() {
(item.hasOwnProperty('freeLength') && Number(item.freeLength)) || 0 const param = this.handleSaveData();
let unitAmt = // 完工事件埋点
(item.hasOwnProperty('unitAmt') && Number(item.unitAmt)) || 0 getApp().track('order_finish', {
amount += Math.max(useLength - freeLength, 0) * unitAmt id: this.vuex_user.id,
if (item.hasOwnProperty('extraAmt') && Number(item.extraAmt)) { mobile: this.vuex_user.mobile,
amount += Number(item.extraAmt) orderId: Number(this.orderId)
} });
}) this.$u.api.saveCompleteData(param, this.orderId).then(async res => {
} if (res.code == 200) {
return amount //完工项信息保存成功再次完工工单
}, // if (!this.exception) { // 核销配件
// const submitPart = await this.submitParts()
// if (!submitPart) return
// }
setData(data) { if (this.inGuaranteePeriod === 'Y') {
// 通过页面设置数据 this.$u.api.inOrderFinish(this.orderId).then(res => {
Object.keys(data).forEach((key) => { if (res.code == 200) {
this.$set(this.form, key, data[key]) this.successTips();
}) } else {
// 更新预计超出金额 this.$refs.uToast.show({
let amount = 0 title: res.data,
amount += this.calMaterialCraftListAmount(this.form.materialList) type: 'error'
amount += this.calMaterialCraftListAmount(this.form.craftList) });
this.$set(this.form, 'overAmount', amount || 0) }
}, });
// 字段的值更新 } else {
fieldValueChange(data) { this.$u.api.outOrderFinish({ customerPayType: 'CASH' }, this.orderId).then(res => {
const groupItem = this.list[this.tabIndex].items[data.groupIndex] if (res.code == 200) {
let innerItem this.successTips();
if (groupItem.items) { } else {
innerItem = groupItem.items[data.itemIndex] this.$refs.uToast.show({
} title: res.data,
type: 'error'
});
}
});
}
} else {
this.$refs.uToast.show({
title: res.message,
type: 'error'
});
}
});
},
// 提交成功后续
successTips() {
uni.showModal({
title: '提交成功',
content: '是否查看本单服务质量详情?',
confirmText: '好的',
cancelText: '算了',
success: res => {
if (res.confirm) {
uni.reLaunch({
url: `/pages/order/quality?id=${this.orderId}`
});
} else if (res.cancel) {
if (this.completeBack) {
// 从订单管理和浏览记录进来
uni.navigateBack({
delta: this.completeBack
});
} else {
uni.reLaunch({
url: '/pages/index/order?type=audit'
});
}
}
}
});
},
calMaterialCraftListAmount(arr) {
let amount = 0;
if (arr) {
arr.forEach(item => {
let useLength = (item.hasOwnProperty('useLength') && Number(item.useLength)) || 0;
let freeLength = (item.hasOwnProperty('freeLength') && Number(item.freeLength)) || 0;
let unitAmt = (item.hasOwnProperty('unitAmt') && Number(item.unitAmt)) || 0;
amount += Math.max(useLength - freeLength, 0) * unitAmt;
if (item.hasOwnProperty('extraAmt') && Number(item.extraAmt)) {
amount += Number(item.extraAmt);
}
});
}
return amount;
},
if (innerItem.fieldsType === 'multiInput') { setData(data) {
// 多个输入框的值触发 // 通过页面设置数据
let key = Object.keys(data.value)[0] Object.keys(data).forEach(key => {
this.form[key] = data.value[key] this.$set(this.form, key, data[key]);
} else { });
if (innerItem.fieldsName === 'orderSpareParts' && data.value === '[]') { // 更新预计超出金额
this.$set(this.form, innerItem.fieldsName, '') let amount = 0;
} else { amount += this.calMaterialCraftListAmount(this.form.materialList);
this.$set(this.form, innerItem.fieldsName, data.value) amount += this.calMaterialCraftListAmount(this.form.craftList);
} this.$set(this.form, 'overAmount', amount || 0);
} },
// 字段的值更新
fieldValueChange(data) {
const groupItem = this.list[this.tabIndex].items[data.groupIndex];
let innerItem;
if (groupItem.items) {
innerItem = groupItem.items[data.itemIndex];
}
// 根据选择的值隐藏对应的项 if (innerItem.fieldsType === 'multiInput') {
if (fields[innerItem.fieldsName]) { // 多个输入框的值触发
groupItem.items.forEach(c => { let key = Object.keys(data.value)[0];
if (fields[innerItem.fieldsName]['fieldsName'].includes(c.fieldsName)) { this.form[key] = data.value[key];
c.required = data.value !== fields[innerItem.fieldsName]['value'] } else {
} if (innerItem.fieldsName === 'orderSpareParts' && data.value === '[]') {
}) this.$set(this.form, innerItem.fieldsName, '');
} } else {
this.$set(this.form, innerItem.fieldsName, data.value);
}
}
if ( // 根据选择的值隐藏对应的项
innerItem.fieldsName === 'pipe' || if (fields[innerItem.fieldsName]) {
innerItem.fieldsName === 'pipeUseLength' groupItem.items.forEach(c => {
) { if (fields[innerItem.fieldsName]['fieldsName'].includes(c.fieldsName)) {
// 申请费用计算 c.required = data.value !== fields[innerItem.fieldsName]['value'];
this.calcMoney() }
} });
// console.log("this.form", this.form) }
},
// 申请费用计算
calcMoney() {
const price = parseInt(this.form.pipe) || 0
const pipeUseLength = parseFloat(this.form.pipeUseLength) || 0
if (price && pipeUseLength) {
const money = (price * pipeUseLength).toFixed(2)
this.$set(this.form, 'pipeAmount', money)
} else {
this.$set(this.form, 'pipeAmount', 0)
}
},
// ------------------------- 以下方法为上传组件相关 -------------------------
// 弹出上传选项
selectUpload(item, groupIndex, itemIndex) {
const imgList = this.$refs[`fileChild${groupIndex}${itemIndex}`][0]
.imgList
if (imgList.length === 10) {
return this.$refs.uToast.show({
title: '图片已超出最大数量',
type: 'error',
})
}
this.photoItem = {
...JSON.parse(item),
groupIndex,
itemIndex,
}
// 弹窗展示
this.maskShow = true
},
// 区分上传动作
uploadSelect(index) {
if (index === 0) {
this.uploadFile('photo')
} else {
this.uploadFile()
}
},
// 拍照回调
async closeTake(val) {
if (val && val.length > 0) {
const order = {
orderNumber: this.orderNumber,
fieldsName: this.photoItem.fieldsName,
fieldsTitle: this.photoItem.fieldsTitle,
uploadType: 'camera',
}
const value = await this.saveToTask(val, order)
this.$refs[
`fileChild${this.photoItem.groupIndex}${this.photoItem.itemIndex}`
][0].setTmpValue(value)
}
this.takeStatus = false
},
// 上传图片
async uploadFile(type) {
const self = this
if (type && type === 'photo') {
// 直接打开相册
let options = {
sourceType: ['album'], //['album', 'camera']
count: 3,
sizeType: ['original'],
}
const order = {
orderNumber: this.orderNumber,
fieldsName: this.photoItem.fieldsName,
fieldsTitle: this.photoItem.fieldsTitle,
uploadType: 'album',
}
const value = await this.chooseImg(options, order)
self.$refs[
`fileChild${self.photoItem.groupIndex}${self.photoItem.itemIndex}`
][0].setTmpValue(value)
return
}
// 使用拍照工具拍摄
this.photograph()
this.getWatermark()
},
// 获取拍照规范
photograph() {
let self = this
let param = {
partnerCompanyId: this.partnerCompanyId || '',
categoryId: this.categoryId,
brandId: this.brandId || '',
fieldName: this.photoItem.fieldsName,
}
this.$u.api.orderStandardItem(param).then((res) => {
if (res.code == 200 && res.data.length > 0) {
self.currentItemDate = res.data[0]
} else {
console.log('获取完工项的拍照标准异常', res.data.message)
}
self.takeStatus = true
})
},
// 获取水印
getWatermark() {
if (getApp().globalData.photo.waterSetting) {
return
}
var data = { partnerCompanyId: this.partnerCompanyId || '' }
this.$u.api.getWatermark(data).then((res) => {
if (res.code == 200) {
getApp().globalData.photo.waterSetting = res.data
} else {
console.log('获取水印备注异常', res.data.message)
}
})
},
// ------------------------- 以上方法为上传组件相关 -------------------------
// ------------------------- 以下方法为展示滚动切换 ------------------------- if (innerItem.fieldsName === 'pipe' || innerItem.fieldsName === 'pipeUseLength') {
// 点击左边的栏目切换 // 申请费用计算
async swichMenu(index) { this.calcMoney();
if (this.arr.length == 0) { }
await this.getMenuItemTop() // console.log("this.form", this.form)
} },
// if (index == this.current) return; // 申请费用计算
this.scrollRightTop = this.oldScrollTop calcMoney() {
this.$nextTick(function() { const price = parseInt(this.form.pipe) || 0;
setTimeout(() => { const pipeUseLength = parseFloat(this.form.pipeUseLength) || 0;
// 没有指定滚动到某一小项,就滚动到大的项 if (price && pipeUseLength) {
this.scrollRightTop = this.arr[index] const money = (price * pipeUseLength).toFixed(2);
this.current = index this.$set(this.form, 'pipeAmount', money);
}, 100) } else {
}) this.$set(this.form, 'pipeAmount', 0);
}, }
// 获取右边菜单每个item到顶部的距离 },
getMenuItemTop() { // ------------------------- 以下方法为上传组件相关 -------------------------
new Promise((resolve) => { // 弹出上传选项
let selectorQuery = uni.createSelectorQuery() selectUpload(item, groupIndex, itemIndex) {
selectorQuery const imgList = this.$refs[`fileChild${groupIndex}${itemIndex}`][0].imgList;
.selectAll('.class-item') if (imgList.length === 10) {
.boundingClientRect((rects) => { return this.$refs.uToast.show({
// 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行 title: '图片已超出最大数量',
if (!rects.length) { type: 'error'
setTimeout(() => { });
this.getMenuItemTop() }
}, 10) this.photoItem = {
return ...JSON.parse(item),
} groupIndex,
rects.forEach((rect) => { itemIndex
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况) };
this.arr.push(rect.top - rects[0].top) // 弹窗展示
resolve() this.maskShow = true;
}) },
}) // 区分上传动作
.exec() uploadSelect(index) {
}) if (index === 0) {
}, this.uploadFile('photo');
// 右边菜单滚动 } else {
async rightScroll(e) { this.uploadFile();
this.oldScrollTop = e.detail.scrollTop }
if (this.arr.length == 0) { },
await this.getMenuItemTop() // 拍照回调
} async closeTake(val) {
if (this.timer) return if (val && val.length > 0) {
this.timer = setTimeout(() => { const order = {
// 节流 orderNumber: this.orderNumber,
this.timer = null fieldsName: this.photoItem.fieldsName,
// scrollHeight为右边菜单垂直中点位置 fieldsTitle: this.photoItem.fieldsTitle,
let scrollHeight = e.detail.scrollTop uploadType: 'camera'
for (let i = 0; i < this.arr.length; i++) { };
let height1 = this.arr[i] const value = await this.saveToTask(val, order);
let height2 = this.arr[i + 1] this.$refs[`fileChild${this.photoItem.groupIndex}${this.photoItem.itemIndex}`][0].setTmpValue(value);
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可 }
if (!height2 || (scrollHeight >= height1 && scrollHeight < height2)) { this.takeStatus = false;
this.current = i },
return // 上传图片
} async uploadFile(type) {
} const self = this;
}, 100) if (type && type === 'photo') {
}, // 直接打开相册
handleTouchstart() { let options = {
// 防止输入光标滚动出现错乱 sourceType: ['album'], //['album', 'camera']
uni.hideKeyboard() count: 3,
}, sizeType: ['original']
// 返回上一页更新订单状态 };
backGo() { const order = {
// const pages = getCurrentPages() orderNumber: this.orderNumber,
// const beforePage = pages[pages.length - 2] fieldsName: this.photoItem.fieldsName,
// if (beforePage.$vm.loadOrderDetail) beforePage.$vm.loadOrderDetail() fieldsTitle: this.photoItem.fieldsTitle,
uni.navigateBack() uploadType: 'album'
}, };
}, const value = await this.chooseImg(options, order);
} self.$refs[`fileChild${self.photoItem.groupIndex}${self.photoItem.itemIndex}`][0].setTmpValue(value);
return;
}
// 使用拍照工具拍摄
this.photograph();
this.getWatermark();
},
// 获取拍照规范
photograph() {
let self = this;
let param = {
partnerCompanyId: this.partnerCompanyId || '',
categoryId: this.categoryId,
brandId: this.brandId || '',
fieldName: this.photoItem.fieldsName
};
this.$u.api.orderStandardItem(param).then(res => {
if (res.code == 200 && res.data.length > 0) {
self.currentItemDate = res.data[0];
} else {
console.log('获取完工项的拍照标准异常', res.data.message);
}
self.takeStatus = true;
});
},
// 获取水印
getWatermark() {
if (getApp().globalData.photo.waterSetting) {
return;
}
var data = { partnerCompanyId: this.partnerCompanyId || '' };
this.$u.api.getWatermark(data).then(res => {
if (res.code == 200) {
getApp().globalData.photo.waterSetting = res.data;
} else {
console.log('获取水印备注异常', res.data.message);
}
});
},
// ------------------------- 以上方法为上传组件相关 -------------------------
// ------------------------- 以下方法为展示滚动切换 -------------------------
// 点击左边的栏目切换
async swichMenu(index) {
if (this.arr.length == 0) {
await this.getMenuItemTop();
}
// if (index == this.current) return;
this.scrollRightTop = this.oldScrollTop;
this.$nextTick(function() {
setTimeout(() => {
// 没有指定滚动到某一小项,就滚动到大的项
this.scrollRightTop = this.arr[index];
this.current = index;
}, 100);
});
},
// 获取右边菜单每个item到顶部的距离
getMenuItemTop() {
new Promise(resolve => {
let selectorQuery = uni.createSelectorQuery();
selectorQuery
.selectAll('.class-item')
.boundingClientRect(rects => {
// 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行
if (!rects.length) {
setTimeout(() => {
this.getMenuItemTop();
}, 10);
return;
}
rects.forEach(rect => {
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况)
this.arr.push(rect.top - rects[0].top);
resolve();
});
})
.exec();
});
},
// 右边菜单滚动
async rightScroll(e) {
this.oldScrollTop = e.detail.scrollTop;
if (this.arr.length == 0) {
await this.getMenuItemTop();
}
if (this.timer) return;
this.timer = setTimeout(() => {
// 节流
this.timer = null;
// scrollHeight为右边菜单垂直中点位置
let scrollHeight = e.detail.scrollTop;
for (let i = 0; i < this.arr.length; i++) {
let height1 = this.arr[i];
let height2 = this.arr[i + 1];
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
if (!height2 || (scrollHeight >= height1 && scrollHeight < height2)) {
this.current = i;
return;
}
}
}, 100);
},
handleTouchstart() {
// 防止输入光标滚动出现错乱
uni.hideKeyboard();
},
// 返回上一页更新订单状态
backGo() {
// const pages = getCurrentPages()
// const beforePage = pages[pages.length - 2]
// if (beforePage.$vm.loadOrderDetail) beforePage.$vm.loadOrderDetail()
uni.navigateBack();
}
}
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// ---------------------------- 表单样式begin ---------------------------- // ---------------------------- 表单样式begin ----------------------------
/deep/ .u-form-item { /deep/ .u-form-item {
.u-form-item__message { .u-form-item__message {
padding-left: 0 !important; padding-left: 0 !important;
} }
.u-form-item--left__content--required { .u-form-item--left__content--required {
vertical-align: top; vertical-align: top;
} }
} }
.class-item { .class-item {
background-color: #fff; background-color: #fff;
padding: 28rpx; padding: 28rpx;
border-radius: 8rpx; border-radius: 8rpx;
.title { .title {
font-weight: bold; font-weight: bold;
font-size: 32rpx; font-size: 32rpx;
line-height: 32rpx; line-height: 32rpx;
color: #333; color: #333;
} }
.label { .label {
color: #333; color: #333;
font-size: 28rpx; font-size: 28rpx;
line-height: 40rpx; line-height: 40rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
.label-bold { .label-bold {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
.required { .required {
padding-right: 10rpx; padding-right: 10rpx;
font-size: 28rpx; font-size: 28rpx;
line-height: 40rpx; line-height: 40rpx;
color: #fa3534; color: #fa3534;
} }
.item-image { .item-image {
width: 24rpx; width: 24rpx;
height: 24rpx; height: 24rpx;
margin-right: 10rpx; margin-right: 10rpx;
} }
} }
// ---------------------------- 表单样式end ---------------------------- // ---------------------------- 表单样式end ----------------------------
.com-content { .com-content {
height: calc(100vh); height: calc(100vh);
/* #ifdef H5 */ /* #ifdef H5 */
height: calc(100vh - var(--window-top)); height: calc(100vh - var(--window-top));
/* #endif */ /* #endif */
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: #ffffff; background-color: #ffffff;
background-image: linear-gradient(to top, #2272ff 0%, #2272ff 100%); background-image: linear-gradient(to top, #2272ff 0%, #2272ff 100%);
background-size: 750rpx 600rpx; background-size: 750rpx 600rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.u-search-box { .u-search-box {
padding: 18rpx 30rpx; padding: 18rpx 30rpx;
} }
.order-tabs { .order-tabs {
margin-top: 20rpx; margin-top: 20rpx;
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
.u-menu-wrap { .u-menu-wrap {
// flex: 1; // flex: 1;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
// overflow: hidden; // overflow: hidden;
border-radius: 12rpx 12rpx 0 0; border-radius: 12rpx 12rpx 0 0;
} }
.detail-view { .detail-view {
border-radius: 12rpx; border-radius: 12rpx;
margin: 30rpx; margin: 30rpx;
} }
.u-search-inner { .u-search-inner {
background-color: rgb(234, 234, 234); background-color: rgb(234, 234, 234);
border-radius: 100rpx; border-radius: 100rpx;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 10rpx 16rpx; padding: 10rpx 16rpx;
} }
.u-search-text { .u-search-text {
font-size: 26rpx; font-size: 26rpx;
color: $u-tips-color; color: $u-tips-color;
margin-left: 10rpx; margin-left: 10rpx;
} }
.u-tab-view { .u-tab-view {
width: 200rpx; width: 200rpx;
height: 100%; height: 100%;
border: 4rpx solid #f4f5f7; border: 4rpx solid #f4f5f7;
overflow: auto; overflow: auto;
} }
.u-tab-item { .u-tab-item {
height: 110rpx; height: 110rpx;
background: #fff; background: #fff;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 26rpx; font-size: 26rpx;
color: #333333; color: #333333;
font-weight: 400; font-weight: 400;
line-height: 1; line-height: 1;
} }
.u-tab-item-active { .u-tab-item-active {
position: relative; position: relative;
color: #2272ff; color: #2272ff;
background: #fff; background: #fff;
} }
// .u-tab-item-active::before { // .u-tab-item-active::before {
...@@ -1494,91 +1382,91 @@ export default { ...@@ -1494,91 +1382,91 @@ export default {
// } // }
.u-tab-view { .u-tab-view {
height: 100%; height: 100%;
} }
.right-box, .right-box,
.right-boxs { .right-boxs {
// background-color: rgb(250, 250, 250); // background-color: rgb(250, 250, 250);
background-color: #ffffff; background-color: #ffffff;
overflow: auto; overflow: auto;
width: 100%; width: 100%;
} }
.page-view { .page-view {
padding: 16rpx; padding: 16rpx;
} }
.class-item:last-child { .class-item:last-child {
max-height: 100vh; max-height: 100vh;
} }
.item-title { .item-title {
font-size: 26rpx; font-size: 26rpx;
color: $u-main-color; color: $u-main-color;
font-weight: bold; font-weight: bold;
} }
.item-menu-name { .item-menu-name {
font-weight: normal; font-weight: normal;
font-size: 24rpx; font-size: 24rpx;
color: $u-main-color; color: $u-main-color;
} }
.item-container { .item-container {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.thumb-box { .thumb-box {
width: 33.333333%; width: 33.333333%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
margin-top: 20rpx; margin-top: 20rpx;
} }
.item-menu-image { .item-menu-image {
width: 120rpx; width: 120rpx;
height: 120rpx; height: 120rpx;
} }
/*提交按钮*/ /*提交按钮*/
.btn-bottom { .btn-bottom {
border: 2rpx solid #f4f5f7; border: 2rpx solid #f4f5f7;
} }
.btn-wrap { .btn-wrap {
width: 100%; width: 100%;
padding: 20rpx 0 44rpx 0; padding: 20rpx 0 44rpx 0;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.read-only { .read-only {
justify-content: flex-end; justify-content: flex-end;
padding-right: 30rpx; padding-right: 30rpx;
} }
.btn-save { .btn-save {
color: #ffffff; color: #ffffff;
background-color: #2272ff; background-color: #2272ff;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
.img-list { .img-list {
position: relative; position: relative;
margin: 8rpx; margin: 8rpx;
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
.pic { .pic {
// margin-right: 15rpx; // margin-right: 15rpx;
// margin-bottom: 15rpx; // margin-bottom: 15rpx;
&:nth-child(3n) { &:nth-child(3n) {
margin-right: 0; margin-right: 0;
} }
} }
} }
</style> </style>
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