Commit 9b49e902 authored by Damon's avatar Damon

Merge branch 'dev' of https://git.banshouhui.com/lijundan/self-support into dev

parents f9bbbfaa e4b1b532
......@@ -26,37 +26,57 @@
buttons: {
type: Array,
default () {
return [{
label: '过程反馈',
type: 'image',
image: 'guochengfankui.png',
show: true,
disabled: false,
},
{
label: '异常签到',
type: 'image',
image: 'yichangqiandao.png',
show: false,
disabled: false
},
{
label: '现场拍照',
type: 'image',
image: 'xiancahngpaizhao.png',
show: true,
disabled: false,
},
{
label: '接单',
type: 'text',
show: true,
disabled: true,
customStyle: {
'background-color': '#2272FF'
}
}
]
// id: 0 主流程; 1 过程反馈;2 异常签到; 3 现场拍照; 4 配件申请
// label: 按钮文字,
// type: 'image' 上图片下文字;'text' 纯文字,
// image: 图片名,
// show: 是否显示,
// disabled: 是 禁用;否 正常,
// id: 区分各个按钮
return [{
label: '过程反馈',
type: 'image',
image: 'guochengfankui.png',
show: false,
disabled: false,
id: 1
},
{
label: '异常签到',
type: 'image',
image: 'yichangqiandao.png',
show: false, // 待签到显示
disabled: false,
id: 2
},
{
label: '现场拍照',
type: 'image',
image: 'xiancahngpaizhao.png',
show: false,
disabled: false,
id: 3
},
{
label: '配件申请',
type: 'image',
image: 'peijian.png',
show: false,
disabled: false,
count: 0,
id: 4
},
{
label: '去接单',
type: 'text',
image: '',
show: true,
disabled: false,
id: 0,
customStyle: {
'background-color': '#D1D4D4'
}
}]
}
}
},
......
......@@ -3,7 +3,7 @@
<view class="return-cell" @click="handleClick">
<view class="title-view">
<text class="title-text" :style="{'color': titleColor}">{{title}}</text>
<view class="express-view" @click.stop="$u.throttle(handleClickExpress, 500)">
<view class="express-view" @click.stop="$u.throttle(handleClickExpress, 500)" v-if="info.express.number">
<text>物流单号:</text>
<view class="order-file-right">
<text>{{info.express.number}}</text>
......@@ -17,7 +17,7 @@
<image class="image-view" v-for="(item, index) in images" :key="index" :src="item"></image>
<view class="info-view" v-if="info.items.length == 1">
<view class="name-text">{{info.items[0].name}}</view>
<view>{{info.items[0].categoryName + '-' + info.items[0].brandName}}</view>
<view>{{noteText}}</view>
</view>
</view>
<view class="count-view">{{info.items.length}}</view>
......@@ -91,6 +91,13 @@
buttonText() {
return this.texts[this.info.status]
},
noteText() {
if (this.info.items[0].categoryName || this.info.items[0].brandName) {
return (this.info.items[0].categoryName || '通用') + '-' + (this.info.items[0].brandName || '通用')
} else {
return '通用'
}
},
buttonStyle() {
return {
'height': '104rpx',
......
<template>
<view class="spare-item">
<view class="left-view">
<u-checkbox v-if="showChecked" icon-size="28" size="40" v-model="item.selected" @change="handleChange" shape="circle"/>
<u-checkbox v-if="showChecked" icon-size="28" size="40" v-model="check" @change="handleChange" shape="circle"/>
<image class="image-view" :src="imageUrl"></image>
<view class="info-view">
<view class="name-text">{{item.name}}</view>
......@@ -10,7 +10,7 @@
</view>
<view class="count-view">
<view v-if="showChecked">
<u-number-box v-model="item.quantity" :min="item.min || 0" :max="item.max || item[type]" @change="numChange"></u-number-box>
<u-number-box v-model="value" :min="item.min || 0" :max="item.max || item[type]" @change="numChange"></u-number-box>
</view>
<text v-else>x{{item[type]|| 0}}</text>
</view>
......@@ -39,16 +39,22 @@
noteText: {
type: String,
default: ''
}
},
},
data() {
return {
value: 0,
check: false,
oldCount: 0
}
},
computed: {
remarkText() {
return this.item.categoryName + '-' + this.item.brandName
if (this.item.categoryName || this.item.brandName) {
return (this.item.categoryName || '通用') + '-' + (this.item.brandName || '通用')
} else {
return '通用'
}
},
imageUrl() {
return this.item.images ? process.uniEnv.systemUrl.apiUrl + this.item.images.split(',').shift() : this.placeholderImage
......@@ -60,21 +66,27 @@
watch: {
showChecked(val) {
this.oldCount = 0
}
},
'item.quantity'(val) {
this.value = val
},
'item.selected'(val) {
this.check = val
this.value= val ? this.item.stock : 0
},
},
methods: {
handleChange() {
this.item.selected = !this.item.selected
this.$emit('change', this.item.selected)
handleChange(event) {
this.value= event.value ? this.item.stock : 0
this.$emit('change', event.value)
},
numChange(event) {
if (event.value == 0 && this.oldCount > 0) {
this.item.selected = false
this.$emit('change', this.item.selected)
this.check = false
this.$emit('change', this.check)
} else if (event.value > 0 && this.oldCount == 0) {
this.item.selected = true
this.$emit('change', this.item.selected)
this.check = true
this.$emit('change', this.check)
}
this.oldCount = event.value
this.$emit('numChange', event.value)
......
......@@ -62,7 +62,7 @@
return {
info: {
items: [],
express: [],
express: {},
status: '0'
},
logisticsRecords: [], // 物流
......@@ -170,7 +170,8 @@
var pages = getCurrentPages();
if (pages.length >= 2) {
var page = pages[pages.length - 2];
this.info = page.info
this.info = page.info
this.info.express = this.info.express || {}
}
},
methods: {
......
......@@ -137,14 +137,11 @@
this.searchedKeyword = this.keyword
this.$u.api.reserveList(param).then((res) => {
if (res.code == 200) {
for(var item of res.data) {
item.max = item.quantity
}
if (res.code == 200) {
this.partsList = []
let list = res.data || []
for (var item of list) {
item.selected = false
item.selected = false
this.partsList.push(item)
}
......
......@@ -168,6 +168,7 @@
showCountTime : false, // 从上个页面传入是否显示倒计时
showApplyList: false, // 显示已申请配件列表
partsList: [], // 已申请的配件列表
partsCount: 0
}
},
computed: {
......@@ -218,7 +219,7 @@
image: 'peijian.png',
show: this.allowFeedback,
disabled: false,
count: 0,
count: this.partsCount,
id: 4
},
{
......@@ -458,7 +459,7 @@
this.$u.api.getOrderPartsSum(this.orderId).then((res) => {
if (res.code == 200) {
if (res.data) {
this.buttons[3].count = res.data.totalPartCount
this.partsCount = res.data.totalPartCount
}
} else {
console.log(res.message)
......
......@@ -142,6 +142,8 @@ export default {
this.$u.route({
url: "pages/parts/addParts",
params: {
type: 1,
brandId: this.order.brandId,
categaryId: this.order.categoryId
}
})
......@@ -192,8 +194,7 @@ export default {
}
const address = this.addressInfo
let params = {
workOrderId: this.orderId,
applyType: this.applyType,
applyType: '1',
remark: this.remark,
parts: JSON.stringify(this.parts),
name: address.name,
......@@ -202,12 +203,17 @@ export default {
city: address.region[1],
district: address.region[2],
address: address.address,
images: null,
}
this.$u.api.applyParts(params).then((res) => {
if (res.code == 200) {
this.$u.api.createParts(params).then((res) => {
if (res.code == 200 && res.data) {
this.$u.route({
type: 'redirect',
url: "pages/parts/nodes"
url: "pages/parts/nodes",
params: {
type: 1,
returnNo: res.data.orderNumber
}
})
} else {
console.log(res.message, "配件申请失败!");
......
......@@ -76,6 +76,48 @@ const imageCache = async function (vm, src, host) {
return image_url
}
}
/*
fromData 多文件提交
@params url 请求的地址
@params data 请求所带参数
*/
const submitFormData = (url, data = null) => new Promise((resolve) => {
/* 规定上传文件的键值做参数处理 */
// 比如
// data = {
// files : [],
// ...params,
// }
/* 把对应的数据处理归位 */
/* 这里有个要注意
虽然 填写了 files uniapp不会去拿 name 和filePath
但 uploadFile 的 name 和 filePath 必填 不然会报错
*/
let files = [];
for (let key in data.files) {
files.push({
name: key,
uri: data.files[key]
});
}
delete data.files;
options.formData = data;
options.files = files;
uni.uploadFile({
success: ({
statusCode,
data
}) => resolve(success(statusCode, data)),
fail: ({
errMsg
}) => resolve(fail(errMsg)),
filePath: '',
name: '',
...options
})
})
module.exports = {
formatTime: function (n) {
var e = n.getFullYear(), r = n.getMonth() + 1, o = n.getDate(), i = n.getHours(), u = n.getMinutes(), a = n.getSeconds();
......@@ -102,4 +144,5 @@ module.exports = {
getOpenid,
setOpenid,
imageCache,
submitFormData,
};
\ No newline at end of file
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