Commit fa906c14 authored by Morson's avatar Morson

feat: 申请配件接口对接

parent 65d8b0e4
......@@ -9,6 +9,10 @@ let partsApiFun = function(vm){
* 配件申请单-查询网点地址信息
*/
let getSiteAddress = async () => await vm.$u.get(coverage + vm.vuex_token + '/getSiteAddress');
/**
* 配件申请单-修改网点地址信息
*/
let updateAddress = async (params = {}) => await vm.$u.post(coverage + vm.vuex_token + '/updateSiteAddress', params);
/**
* 配件过滤-品类列表
*/
......@@ -21,12 +25,18 @@ let partsApiFun = function(vm){
* 查询配件列表
*/
let getPartsList = async (params = {}) => await vm.$u.get(parts + vm.vuex_token + '/parts', params);
/**
* 配件申请单-创建申请单/使用备件
*/
let applyParts = async (params = {}) => await vm.$u.post(parts + vm.vuex_token + '/orders', params)
const partsApi = {
getSiteAddress,
updateAddress,
getCategoryList,
getBrandList,
getPartsList
getPartsList,
applyParts
}
return partsApi
}
......
......@@ -518,7 +518,16 @@
"navigationBarTitleText": "配件选择"
}
}
]
,{
"path" : "nodes",
"style" :
{
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#FFFFFF",
"enablePullDownRefresh": false
}
}
]
}
],
"preloadRule": {
......
......@@ -29,7 +29,8 @@
></u-field>
</view>
<view class="bottom">
<button class="btn, bottom-btn" @click="show = true"><text class="button-text">保存</text></button>
<button class="btn, bottom-btn" v-if="siteType=='select'" @click="$u.throttle(commitSite, 500)"><text class="button-text">提交</text></button>
<button class="btn, bottom-btn" v-else @click="show = true"><text class="button-text">保存</text></button>
<!-- <view class="default">
<view class="left">
<view class="set">设置默认地址</view>
......@@ -101,7 +102,6 @@ export default {
if (!this.vuex_token) {
this.$u.route({ url: 'pages/login/index' });
}
debugger
if (e) {
if (e.type === 'add') {
this.title = '新增地址';
......
......@@ -2,7 +2,7 @@
<view class="address-wrap">
<w-navbar title="收货地址"></w-navbar>
<view class="body" v-if="hasAdderss">
<w-address @editSite="toAddSite" :info="address" :is-default="true" />
<w-address @editSite="toAddSite" :info="addressInfo" :is-default="true" />
</view>
</view>
</template>
......@@ -15,6 +15,8 @@ export default {
background: {
backgroundColor: 'none'
},
address: '',
region: [],
siteList: []
};
},
......@@ -28,7 +30,7 @@ export default {
hasAdderss() {
return this.settled && this.settled.address && this.settled.id_card_name
},
address() {
addressInfo() {
return {
name: this.settled.id_card_name || this.settled.nickname || this.settled.name,
mobile: this.settled.mobile,
......@@ -50,6 +52,19 @@ export default {
getData() {
let self = this
app.getBaseInfo(self);
this.getMineSite()
},
getMineSite() {
this.$u.api.getSiteAddress().then((res) => {
if(res.code == 200 && res.data) {
this.address = res.data.address
this.region = [
res.data.provinceName,
res.data.cityName,
res.data.districtName
]
}
})
},
toAddSite(title){
this.$u.route({
......
......@@ -30,7 +30,7 @@
</view>
<view class="card address">
<view class="title">收件信息</view>
<view class="subsection u-flex u-row-center">
<view class="subsection">
<u-subsection
:list="siteTypes" :current="curType"
:bold="false" font-size="26" height="76"
......@@ -45,7 +45,7 @@
</view>
</view>
<view class="bottom">
<u-button shape="circle" :disabled="disabled" :hair-line="false" :custom-style="customStyle" hover-class="none">提交</u-button>
<u-button shape="circle" :disabled="isEmptyParts" :hair-line="false" :custom-style="customStyle" hover-class="none" @click="submitParts">提交</u-button>
</view>
</view>
</template>
......@@ -59,6 +59,7 @@ export default {
data() {
return {
orderId: 0,
applyType: 0,
order: {},
parts: [],
disabled: false,
......@@ -93,16 +94,21 @@ export default {
},
onLoad(e) {
this.orderId = e && Number(e.orderId) || 0
this.applyType = e && Number(e.applyType) || 0
this.initData()
},
methods: {
initData() {
this.loadMineAddress()
this.loadOrderInfo()
this.parts = [
{name: '正泰漏保', num: 2},
{name: '电缆VJV3*10', num: 1},
{name: '挚达系统广汽充电桩', num: 0},
{name: '空开盒子', num: 100}
]
},
loadMineAddress() {
this.mine.address = "广东省深圳市宝安区宝城67区留芳路6号庭威产业园3栋10C"
this.mine.region = ['广东省', '深圳市', '宝安区']
this.$u.api.getSiteAddress().then((res) => {
if(res.code == 200 && res.data) {
this.mine.address = res.data.address
......@@ -144,22 +150,9 @@ export default {
mobile: this.order.contactPhone,
address: address,
region: region,
code: [
this.order.contactProvince,
this.order.contactCity,
this.order.contactCommunity,
]
}
}
},
loadParts() {
this.parts = [
{name: '正泰漏保', num: 2},
{name: '电缆VJV3*10', num: 1},
{name: '挚达系统广汽充电桩', num: 0},
{name: '空开盒子', num: 100}
]
},
qnFile(src) {
return process.uniEnv.qn_base_url + src
},
......@@ -178,9 +171,7 @@ export default {
mobile: this.addressInfo.mobile,
address: address,
region: this.addressInfo.region.join('-'),
code: this.addressInfo.code && this.addressInfo.code.join('-'),
};
console.log("editSite", params)
this.$u.route({
url: "pages/mine/address/addSite",
params: params
......@@ -198,6 +189,60 @@ export default {
url: "pages/parts/addParts"
})
},
updateParts(parts) {
if(this.$u.test.isEmpty(parts)) {
this.parts = []
} else {
this.parts = parts
}
},
/**
* workOrderId 工单ID,保内申请时必须指定
* applyType 申请类型:0 保内,1 备件,2 购买,10 使用备件
* remark 申请备注
* parts 申请的配件明细,JSON 格式,指定多条要申请的配件信息,
* 数组中的每个对象需要 part_id(配件ID)和 quantity(申请数量)两个字段。
* 如果没有选择明细,请保持空。此时必须填写备注
* barcode 产品条码
* measures 服务措施
* name 收件人姓名
* phoneNumber 收件人电话号码
* province 收件地址:省
* city 收件地址:市
* district 收件地址:区
* street 收件地址:街道
* address 收件详细地址
* images 申请图片文件、可以传多张
*/
submitParts() {
const address = this.addressInfo
let params = {
workOrderId: orderId,
applyType: this.applyType,
remark: this.remark,
parts: JSON.stringty(parts),
barcode: this.order.barcode,
measures: this.order.measures,
name: address.name,
phoneNumber: address.mobile,
province: address.region[0],
city: address.region[1],
district: address.region[2],
address: address.address,
}
this.$u.api.applyParts(params).then((res) => {
if (res.code == 200) {
this.$u.route({
url: "pages/parts/nodes"
})
} else {
console.log(res.message, "配件申请失败!");
}
});
this.$u.route({
url: "pages/parts/nodes"
})
}
}
};
</script>
......@@ -259,20 +304,18 @@ export default {
}
.address {
.subsection {
padding-top: -6rpx;
padding-bottom: 34rpx;
border-bottom: 2rpx solid #F4F5F7;
// /deep/ .u-subsection {
// width: 372rpx;
// .u-item-bg {
// border-radius: 32rpx !important;
// }
// }
margin: -6rpx 0 34rpx 0;
padding: 0 129rpx;
/deep/ .u-subsection {
.u-item-bg {
border-radius: 32rpx !important;
}
}
}
.body {
border-top: 2rpx solid #F4F5F7;
padding-top: 10rpx;
padding-bottom: 52rpx;
}
}
}
......@@ -281,6 +324,10 @@ export default {
left: 76rpx;
right: 76rpx;
bottom: 68rpx;
/deep/ button[disabled]:not([type]) {
background-color: #D1D4D4 !important;
}
}
}
</style>
<template>
<view class="u-flex-col u-col-center node-wrap">
<u-gap height="200"></u-gap>
<u-image width="224rpx" height="224rpx" :src="qnFile(nodeInfo.icon)"></u-image>
<view class="title">{{nodeInfo.title}}</view>
<view v-show="isReturn" class="return">
<u-divider color="#F4F5F7" half-width="345" margin-top="30" :use-slot="false"></u-divider>
<view class="return-title u-text-center">返件编号</view>
<view class="u-flex u-row-between return-row">
<view class="return-no">{{returnNo}}</view>
<view class="vertical-bar"></view>
<button class="copy-btn" @tap="copyText" :data-text="returnNo">复制</button>
</view>
</view>
<view class="message">{{nodeInfo.message}}</view>
<u-gap v-show="isParts" height="192"></u-gap>
<u-gap v-show="isReturn" height="160"></u-gap>
<button class="back-btn" @click="goBack">{{nodeInfo.btnTxt}}</button>
</view>
</template>
<script>
export default {
data() {
return {
curType: 0,
returnNo: 'RT20210610000001',
nodes: [
{
type: 'parts',
icon: 'successful.png',
title: '您的配件申请已提交成功',
message: '工作人员正在加紧审核中',
btnTxt: '我知道了'
},
{
type: 'return',
icon: 'successful.png',
title: '您的返件信息已提交成功',
message: '请将返件编号复制发给唯修汇对接人',
btnTxt: '我知道了'
}
]
}
},
computed: {
nodeInfo() {
return this.nodes[this.curType]
},
isReturn() {
return this.nodes[this.curType].type == 'return'
},
isParts() {
return this.nodes[this.curType].type == 'parts'
}
},
methods: {
qnFile(src) {
return process.uniEnv.qn_base_url + src
},
goBack() {
this.$u.route({type:'back'})
},
copyText(e) {
console.log(e)
uni.setClipboardData({
data: e.currentTarget.dataset.text,
success: function (res) {
uni.getClipboardData({
success: function (res) {
uni.showToast({
title: '复制成功'
})
}
})
}
})
},
}
}
</script>
<style lang="scss" scoped>
.node-wrap {
width: 750rpx;
height: 100vh;
overflow: auto;
background-color: #FFFFFF;
.title {
font-size: 40rpx;
font-weight: bold;
color: #2272FF;
line-height: 40rpx;
margin-bottom: 30rpx;
}
.return {
.return-title {
margin-top: 60rpx;
font-size: 40rpx;
font-weight: bold;
color: #333333;
}
.return-row {
margin: 52rpx 38rpx;
.return-no {
font-size: 40rpx;
font-weight: 500;
color: #2272FF;
line-height: 60rpx;
}
.vertical-bar {
width: 4rpx;
height: 60rpx;
background: #F4F5F7;
}
.copy-btn {
width: 120rpx;
height: 48rpx;
border-radius: 24rpx;
border: 2rpx solid #999999;
font-size: 26rpx;
font-weight: 400;
color: #999999;
line-height: 48rpx;
margin: 0;
}
}
}
.message {
font-size: 26rpx;
font-weight: 400;
color: #999999;
line-height: 26rpx;
}
.back-btn {
width: 400rpx;
height: 104rpx;
background: #2272FF;
border-radius: 52rpx;
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
line-height: 104rpx;
}
}
</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