Commit 687147c5 authored by Damon's avatar Damon

refactor: 仓配完工接口调整

parent 986061de
...@@ -39,7 +39,7 @@ let partsApiFun = function (vm) { ...@@ -39,7 +39,7 @@ let partsApiFun = function (vm) {
/** /**
* 查询工单的配件明细 * 查询工单的配件明细
*/ */
let getWorkOrderParts = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/items/workOrder/', params); let getWorkOrderParts = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/items/workOrder/' + params.workOrderId);
/** /**
* 返件-备件/新件 * 返件-备件/新件
*/ */
......
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
<view class="list u-flex u-row-between"> <view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image> <image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view> <view class="u-m-r-20">{{item.fieldsTitle}}</view>
<view class="u-flex-1 add-parts" @click="toParts"> <view class="u-flex-1 add-parts" @click="toParts" v-if="!disabled">
添加配件<u-icon name="arrow-right" color="#2979ff" size="30"></u-icon> 添加备件<u-icon name="arrow-right" color="#2979ff" size="30"></u-icon>
</view> </view>
</view> </view>
<view class="complete-part"> <view class="complete-part">
<view v-if="status === 1"> <view v-if="lists.length > 0">
<adjust-parts v-for="(item, index) in lists" :key="index" :info="item" @change="partsChange($event, index)" :disabled="disabled"></adjust-parts> <adjust-parts v-for="(item, index) in lists" :key="index" :info="item" @change="partsChange($event, index)" :disabled="disabled"></adjust-parts>
</view> </view>
<view class="u-flex select-part" v-else-if="status === 2"> <view class="u-flex select-part" v-else>
<view class="img"> <view class="img">
<image :src="noPartsImage" class="part-icon" /> <image :src="noPartsImage" class="part-icon" />
</view> </view>
<view class="u-flex content"> <view class="u-flex content">
<text class="title">暂无配件信息</text> <text class="title">暂无备件信息</text>
<text class="desc">可选择备件仓配件</text> <text class="desc">可选择备件仓配件</text>
</view> </view>
<view class="btn"> <view class="btn">
...@@ -47,23 +47,7 @@ ...@@ -47,23 +47,7 @@
}, },
data() { data() {
return { return {
lists: [ lists: []
{
id: 1,
name: "正泰漏保",
quantity: 1,
min: 1,
max: 100,
},
{
id: 1,
name: "挚达广汽充电桩",
quantity: 3,
min: 1,
max: 5,
},
],
status: 2
} }
}, },
computed: { computed: {
...@@ -87,34 +71,38 @@ ...@@ -87,34 +71,38 @@
}, },
methods: { methods: {
getWorkOrderParts() { getWorkOrderParts() {
const params = { this.lists = this.dataValue || []
workOrderId: this.orderId
}
this.$u.getWorkOrderParts(params).then(res => {
if (res.code === 200) {
const data = res.data
this.status = data.receivedItems.length > 0 ? 1 : 2
this.lists = data.receivedItems || []
}
})
}, },
partsChange(val, index) { partsChange(val, index) {
console.log("val", val, index)
this.$set(this.lists[index], 'quantity', val) this.$set(this.lists[index], 'quantity', val)
this.valueChange(this.lists)
},
valChange(val) {
val.forEach(v => {
const index = this.lists.findIndex(k => k.part_id === v.part_id)
if (index < 0) {
this.lists.push(v)
} else {
this.$set(this.lists, index, v)
}
})
this.valueChange(this.lists)
}, },
toParts() { toParts() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/order/parts' url: `/pages/order/parts?workOrderId=${this.orderId}`
}) })
},
handle(val) {
console.log("val", val)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.required { .required {
padding-right: 10rpx; padding-right: 10rpx;
font-size: 28rpx; font-size: 28rpx;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{{info.name}} {{info.name}}
</view> </view>
<view class="num"> <view class="num">
<u-number-box v-if="!disabled" v-model="info.quantity" :min="info.min || 0" :max="info.max || info.quantity" @change="numChange"></u-number-box> <u-number-box v-if="!disabled" v-model="info.quantity" :min="info.min || 0" :max="info.max || 999" @change="numChange"></u-number-box>
<text class="nums" v-else>x{{ info.quantity || 1 }}</text> <text class="nums" v-else>x{{ info.quantity || 1 }}</text>
</view> </view>
</view> </view>
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<view class="right-content-name">{{ info.name }}</view> <view class="right-content-name">{{ info.name }}</view>
<view class="right-content-desc">{{ info.remark }}</view> <view class="right-content-desc">{{ info.remark }}</view>
<view class="u-flex right-content-opera"> <view class="u-flex right-content-opera">
<view class="no"> <view class="no" v-if="info.stock">
{{ info.code }} 可用{{ info.stock }}件
</view> </view>
<view class="num"> <view class="num">
<u-number-box v-if="!info.disabled" v-model="info.quantity" :min="info.min || 0" :max="info.max || info.quantity" @change="numChange"></u-number-box> <u-number-box v-if="!info.disabled" v-model="info.quantity" :min="info.min || 0" :max="info.max || info.quantity" @change="numChange"></u-number-box>
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
</xh-service-more> </xh-service-more>
<xh-label v-else-if="item.formType==='label'" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'> <xh-label v-else-if="item.formType==='label'" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'>
</xh-label> </xh-label>
<xh-parts v-else-if="item.formType==='parts'" :order-id="orderId" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'> <xh-parts ref="fileChildParts" v-else-if="item.formType==='parts'" :order-id="orderId" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""' :disabled="orderStatus === '88' || orderStatus === '86'" @value-change="fieldValueChange">
</xh-parts> </xh-parts>
</template> </template>
</u-form-item> </u-form-item>
...@@ -261,6 +261,7 @@ ...@@ -261,6 +261,7 @@
currentItemDate:{}, currentItemDate:{},
photoItem: {}, photoItem: {},
maintainStep: 'partnerInspectItem', maintainStep: 'partnerInspectItem',
orderStatus: ''
// showTab: true, // showTab: true,
} }
}, },
...@@ -294,7 +295,7 @@ ...@@ -294,7 +295,7 @@
this.inGuaranteePeriod = option.inGuaranteePeriod this.inGuaranteePeriod = option.inGuaranteePeriod
this.partnerCompanyId = option.partnerCompanyId this.partnerCompanyId = option.partnerCompanyId
this.auditResultsId = option.auditResultsId this.auditResultsId = option.auditResultsId
this.orderStatus = option.orderStatus
// this.showTab =item.partnerCompanyName == '挚达充电桩' // this.showTab =item.partnerCompanyName == '挚达充电桩'
} else { } else {
this.orderId = 11880091 this.orderId = 11880091
...@@ -427,9 +428,8 @@ ...@@ -427,9 +428,8 @@
return param return param
}, },
saveComplete(){// 保存完工信息 saveComplete(){// 保存完工信息
let self = this const param = this.handleSaveData()
let param = self.handleSaveData() this.$u.api.saveCompleteData(param,this.orderId).then((res)=>{
self.$u.api.saveCompleteData(param,self.orderId).then((res)=>{
if (res.code == 200) { if (res.code == 200) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '保存成功', title: '保存成功',
...@@ -564,8 +564,26 @@ ...@@ -564,8 +564,26 @@
if (this.oldItemId)this.itemId = this.oldItemId if (this.oldItemId)this.itemId = this.oldItemId
}) })
}, },
// 提交配件信息
submitParts() {
const lists = this.form.orderAccessorys.filter(v => v.quantity > 0)
const params = {
workOrderId: this.orderId,
applyType: '10',
parts: lists
}
this.$u.api.applyParts(params).then(res => {
if (res.code !== 200) {
this.$refs.uToast.show({
title: res.data,
type: 'error',
})
}
})
},
// 提交订单 // 提交订单
orderFinish(){ orderFinish(){
this.submitParts()
const param = this.handleSaveData() const param = this.handleSaveData()
// 完工事件埋点 // 完工事件埋点
getApp().track('order_finish', {id: this.vuex_user.id, mobile: this.vuex_user.mobile, orderId: Number(this.orderId)}) getApp().track('order_finish', {id: this.vuex_user.id, mobile: this.vuex_user.mobile, orderId: Number(this.orderId)})
...@@ -666,6 +684,7 @@ ...@@ -666,6 +684,7 @@
if (innerItem.fieldsName === 'pipe' || innerItem.fieldsName === 'pipeUseLength') { // 申请费用计算 if (innerItem.fieldsName === 'pipe' || innerItem.fieldsName === 'pipeUseLength') { // 申请费用计算
this.calcMoney() this.calcMoney()
} }
console.log("this.form", this.form)
}, },
// 申请费用计算 // 申请费用计算
......
...@@ -806,6 +806,7 @@ ...@@ -806,6 +806,7 @@
+ "&partnerCompanyId=" + this.order.partnerCompanyId + "&partnerCompanyId=" + this.order.partnerCompanyId
+ '&partnerCompanyName=' + this.order.partnerCompanyName + '&partnerCompanyName=' + this.order.partnerCompanyName
+ '&maintainStep=' + this.order.maintainStep + '&maintainStep=' + this.order.maintainStep
+ '&orderStatus=' + this.order.orderStatus
}) })
}, },
rejectOrder() { // 拒单 rejectOrder() { // 拒单
......
...@@ -45,7 +45,8 @@ ...@@ -45,7 +45,8 @@
}, },
data() { data() {
return { return {
lists: [] lists: [],
workOrderId: null,
} }
}, },
computed: { computed: {
...@@ -63,7 +64,8 @@ ...@@ -63,7 +64,8 @@
return count === 0 || false return count === 0 || false
} }
}, },
created() { onLoad(e) {
this.workOrderId = parseInt(e.workOrderId)
this.getReserve() this.getReserve()
}, },
methods: { methods: {
...@@ -94,18 +96,19 @@ ...@@ -94,18 +96,19 @@
}) })
}, },
submit() { submit() {
let pages = getCurrentPages()
let prevPage = pages[pages.length - 2]
const lists = this.lists.filter(v => v.checked).map(v => { const lists = this.lists.filter(v => v.checked).map(v => {
return { return {
name: v.name,
part_id: v.skuId, part_id: v.skuId,
quantity: v.quantity quantity: v.quantity,
max: v.max
} }
}) })
prevPage.$vm.handle(lists)
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; //上一个页面
prevPage.$vm.$refs['fileChildParts'][0].valChange(lists)
this.$u.route({ type: 'back' }) this.$u.route({ type: 'back' })
console.log(lists)
}, },
qnFile(src) { qnFile(src) {
return process.uniEnv.qn_base_url + src return process.uniEnv.qn_base_url + src
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
></u-search> ></u-search>
</view> </view>
<view class="categary"> <view class="categary" v-if="type === '2'">
<view class="u-flex u-col-center"> <view class="u-flex u-col-center">
<picker mode="selector" :value="categaryIndex" range-key="label" :range="categary" @click="show = true" @change="changeCategary"> <picker mode="selector" :value="categaryIndex" range-key="label" :range="categary" @click="show = true" @change="changeCategary">
<view class="txt">{{categary[categaryIndex].label || '请选择'}}</view> <view class="txt">{{categary[categaryIndex].label || '请选择'}}</view>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<view class="warp u-flex"> <view class="warp u-flex">
<view class="brand u-flex"> <view class="brand u-flex">
<view class="label-content u-flex"> <view class="label-content u-flex" v-if="brand.length > 0">
<scroll-view <scroll-view
style="width:100%;white-space: nowrap;" style="width:100%;white-space: nowrap;"
scroll-x="true" scroll-x="true"
...@@ -100,7 +100,8 @@ export default { ...@@ -100,7 +100,8 @@ export default {
lists: [], lists: [],
submitList: [], submitList: [],
pageSize: 20, pageSize: 20,
pageNumber: 1 pageNumber: 1,
type: '1'
}; };
}, },
computed: { computed: {
...@@ -118,8 +119,13 @@ export default { ...@@ -118,8 +119,13 @@ export default {
return this.submitList.reduce((counter, { disabled, quantity }) => !disabled ? counter += quantity : counter, 0) return this.submitList.reduce((counter, { disabled, quantity }) => !disabled ? counter += quantity : counter, 0)
} }
}, },
created() { onLoad(e) {
this.getCategaryList() if (e.categaryId) {
this.categoryId = e.categaryId
this.getBrandList()
} else {
this.getCategaryList()
}
}, },
methods: { methods: {
// 获取品类 // 获取品类
...@@ -127,12 +133,16 @@ export default { ...@@ -127,12 +133,16 @@ export default {
this.$u.api.getCategoryList().then(res => { this.$u.api.getCategoryList().then(res => {
if (res.code === 200) { if (res.code === 200) {
const data = res.data const data = res.data
this.categary = data.list ? data.list.map(v => { if (data.length > 0) {
v.label = v.categoryName this.categary = data.map(v => {
return v v.label = v.categoryName
}) : [] return v
this.categaryId = this.categary[0].categoryId })
this.getBrandList() this.categaryId = this.categary[0].categoryId
this.getBrandList()
} else {
this.getPartsList()
}
} }
}) })
}, },
...@@ -141,11 +151,14 @@ export default { ...@@ -141,11 +151,14 @@ export default {
this.$u.api.getBrandList({categoryId: this.categaryId}).then(res => { this.$u.api.getBrandList({categoryId: this.categaryId}).then(res => {
if (res.code === 200) { if (res.code === 200) {
const data = res.data const data = res.data
this.brand = data.list ? data.list.map(v => { console.log("data", data)
v.label = v.brandName if (data.length > 0) {
return v this.brand = data.map(v => {
}) : [] v.label = v.brandName
this.brandId = this.brand[0].brandId return v
})
this.brandId = this.brand[0].brandId
}
this.lists = [] this.lists = []
this.getPartsList() this.getPartsList()
} }
...@@ -158,8 +171,8 @@ export default { ...@@ -158,8 +171,8 @@ export default {
const params = { const params = {
pageNumber: this.pageNumber, pageNumber: this.pageNumber,
pageSize: this.pageSize, pageSize: this.pageSize,
categoryId: this.categaryId, categoryId: this.categaryId || '',
brandId: this.brandId, brandId: this.brandId || '',
keyword: this.keyword keyword: this.keyword
} }
this.$u.api.getPartsList(params).then(res => { this.$u.api.getPartsList(params).then(res => {
...@@ -186,6 +199,7 @@ export default { ...@@ -186,6 +199,7 @@ export default {
searchParts(val) { searchParts(val) {
this.keyword = val this.keyword = val
this.lists = [] this.lists = []
this.pageNumber = 1
this.getPartsList() this.getPartsList()
}, },
// 选择品类 // 选择品类
......
...@@ -31,7 +31,7 @@ const store = new Vuex.Store({ ...@@ -31,7 +31,7 @@ const store = new Vuex.Store({
state: { state: {
// 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量 // 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {}, vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {},
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '', vuex_token: 'RTOKENe4a0c2fb1f93d97d58147a0d41004b00007b2e1e', //lifeData.vuex_token ? lifeData.vuex_token : '',
vuex_cache: lifeData.vuex_cache ? lifeData.vuex_cache : {}, vuex_cache: lifeData.vuex_cache ? lifeData.vuex_cache : {},
vuex_version: '1.0.1', vuex_version: '1.0.1',
vuex_config: {}, vuex_config: {},
......
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