Commit 4197d768 authored by Damon's avatar Damon

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

parents 605ed088 4a214a0d
...@@ -4,6 +4,7 @@ let partsApiFun = function (vm) { ...@@ -4,6 +4,7 @@ let partsApiFun = function (vm) {
const coverage = '/wxh-worker-rest/rest/coverage/' const coverage = '/wxh-worker-rest/rest/coverage/'
const parts = '/wxh-worker-rest/rest/parts/' const parts = '/wxh-worker-rest/rest/parts/'
const base = '/wxh-worker-rest/rest/base/' const base = '/wxh-worker-rest/rest/base/'
const formType = {'content-type': 'application/x-www-form-urlencoded'}
/** /**
* 配件申请单-查询网点地址信息 * 配件申请单-查询网点地址信息
...@@ -12,7 +13,7 @@ let partsApiFun = function (vm) { ...@@ -12,7 +13,7 @@ let partsApiFun = function (vm) {
/** /**
* 配件申请单-修改网点地址信息 * 配件申请单-修改网点地址信息
*/ */
let updateAddress = async (params = {}) => await vm.$u.post(coverage + vm.vuex_token + '/updateSiteAddress', params); let updateAddress = async (params = {}) => await vm.$u.post(coverage + vm.vuex_token + '/updateSiteAddress', params, formType);
/** /**
* 配件过滤-品类列表 * 配件过滤-品类列表
*/ */
......
<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"/>
<image class="image-view" :src="imageUrl"></image>
<view class="info-view">
<view class="name-text">{{item.name}}</view>
<view>{{remarkText}}</view>
</view>
</view>
<view class="count-view">x{{item.quantity}}</view>
</view>
</template>
<script>
export default {
props: {
showChecked: { // 是否显示勾选
type: Boolean,
default() {
return false
}
},
item: {
type: Object,
default() {
return {}
}
},
noteText: {
type: String,
default: ''
}
},
data() {
return {
checked: false
}
},
computed: {
remarkText() {
return this.noteText || this.item.code
// return this.info.categoryName + '-' + this.info.brandName
},
imageUrl() {
return this.item.images ? process.uniEnv.systemUrl.apiUrl + this.item.images.split(',').shift() : this.placeholderImage
},
placeholderImage() {
return process.uniEnv.qn_base_url + 'logo.png'
},
},
methods: {
handleChange() {
this.$emit('change')
}
}
}
</script>
<style lang="scss" scoped>
.spare-item {
display: flex;
// width: 100%;
justify-content: space-between;
align-items: flex-end;
// padding: 30rpx;
// background-color: #FFFFFF;
// border-radius: 12rpx;
.left-view {
display: flex;
align-items: center;
.image-view {
width: 120rpx;
height: 120rpx;
margin-right: 20rpx;
flex-shrink: 0;
}
.info-view {
font-size: 24rpx;
color: #333333;
.name-text {
font-size: 32rpx;
font-weight: bold;
color: #333333;
margin-bottom: 30rpx;
}
}
}
.count-view {
font-size: 28rpx;
color: #333333;
}
}
</style>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="u-flex bottom" :style="customStyle"> <view class="u-flex bottom" :style="customStyle">
<view class="select-view"> <view class="select-view">
<view class="u-flex bottom-left" v-if="showChecked"> <view class="u-flex bottom-left" v-if="showChecked">
<view class="left-list"><u-checkbox icon-size="30" size="40" v-model="checked" @change="selectAll" shape="circle"/></view> <view class="left-list"><u-checkbox icon-size="28" size="40" v-model="checked" @change="selectAll" shape="circle"/></view>
<view class="left-list">全选</view> <view class="left-list">全选</view>
</view> </view>
<view class="u-flex bottom-center"> <view class="u-flex bottom-center">
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
info: { info: {
type: Object, type: Object,
default() { default() {
return {name: '', mobile: '', address: ''}; return {name: '', mobile: '', address: '', region: []};
} }
}, },
isDefault: { isDefault: {
...@@ -73,8 +73,13 @@ export default { ...@@ -73,8 +73,13 @@ export default {
let address = this.info && this.info.address; let address = this.info && this.info.address;
if (this.$u.test.isEmpty(address)) { if (this.$u.test.isEmpty(address)) {
return '--'; return '--';
} else { }
let region = this.info && this.info.region;
let regionStr = region.join('');
if(this.$u.test.contains(address, regionStr)) {
return address; return address;
} else {
return regionStr + address;
} }
} }
}, },
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<view class="list-view"> <view class="list-view">
<view v-for="(group, ind) in items" :key="ind" class="group-view"> <view v-for="(group, ind) in items" :key="ind" class="group-view">
<u-cell-group :border="false"> <u-cell-group :border="false">
<view v-for="(item, index) in group" :key="index.pathName"> <view v-for="(item, index) in group" :key="index">
<u-cell-item :value="item.value" :border-bottom="false" @click="handleClick(item.pathName)"> <u-cell-item :value="item.value" :border-bottom="false" @click="handleClick(item.pathName)">
<image slot="icon" :src="qnFile(item.icon)" :style="item.imageStyle"></image> <image slot="icon" :src="qnFile(item.icon)" :style="item.imageStyle"></image>
<view slot="title" class="item-title">{{item.title}}</view> <view slot="title" class="item-title">{{item.title}}</view>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</view> </view>
<view class="item"> <view class="item">
<view class="left">电话号码</view> <view class="left">电话号码</view>
<input :disabled="mobileStatus" v-model="mobile" type="text" placeholder-class="line" placeholder="请填写收货人手机号" /> <input :disabled="mobileStatus" v-model="mobile" type="text" @blur="verifyMobile" placeholder-class="line" placeholder="请填写收货人手机号" />
</view> </view>
<view class="item"> <view class="item">
...@@ -120,13 +120,19 @@ export default { ...@@ -120,13 +120,19 @@ export default {
if(e.mobile) { if(e.mobile) {
this.mobile = decodeURIComponent(e.mobile); this.mobile = decodeURIComponent(e.mobile);
} }
if(e.address) {
this.address = decodeURIComponent(e.address);
}
if(e.region) { if(e.region) {
let regionStr = decodeURIComponent(e.region); let regionStr = decodeURIComponent(e.region);
this.region = regionStr.split('-') this.region = regionStr.split('-')
} }
if(e.address) {
let address = decodeURIComponent(e.address);
let region = this.region.join('')
if(this.$u.test.contains(address, region)) {
this.address = address.replace(region, '')
} else {
this.address = address
}
}
} }
}, },
onShow() { onShow() {
...@@ -138,34 +144,44 @@ export default { ...@@ -138,34 +144,44 @@ export default {
this.nameStatus = false; this.nameStatus = false;
this.mobileStatus = false; this.mobileStatus = false;
} else if (this.siteType == 'edit') { } else if (this.siteType == 'edit') {
let address = ''; if (this.$u.test.isEmpty(this.name)
if (this.$u.test.isEmpty(this.siteInfo)) { || this.$u.test.isEmpty(this.mobile)) {
const callback = (vm, res) => { const callback = (vm, res) => {
this.settled = res.record; this.settled = res.record;
if (this.loading) { this.name = this.settled.id_card_name;
this.name = this.settled.id_card_name; this.mobile = this.settled.mobile;
this.mobile = this.settled.mobile;
this.address = this.settled.address;
this.geocoding();
}
this.loading = this.$u.test.isEmpty(this.settled);
}; };
if (this.vuex_settled && this.vuex_settled.record) { if (this.vuex_settled && this.vuex_settled.record) {
callback(this, this.vuex_settled); callback(this, this.vuex_settled);
} else { } else {
getApp().getBaseInfo(this, callback); getApp().getBaseInfo(this, callback);
} }
} else { }
if (this.loading) {
this.loading = false; if (this.$u.test.isEmpty(this.region)
this.name = this.siteInfo.name; || this.$u.test.isEmpty(this.address)) {
this.mobile = this.siteInfo.mobile;
this.address = this.siteInfo.address;
this.geocoding();
}
} }
} }
}, },
loadMineAddress() {
this.$u.api.getSiteAddress().then((res) => {
if(res.code == 200 && res.data) {
this.region = [
res.data.provinceName,
res.data.cityName,
res.data.districtName
]
let address = res.data.address
const regionStr = this.region.join('')
if(this.$u.test.contains(address, regionStr)) {
this.address = address.replace(regionStr, '')
} else {
this.address = address
}
}
})
},
showRegionPicker() { showRegionPicker() {
this.showPicker = true; this.showPicker = true;
}, },
...@@ -234,23 +250,54 @@ export default { ...@@ -234,23 +250,54 @@ export default {
}); });
}, },
verifyMobile() {
if(this.$u.test.isEmpty(this.mobile)) {
this.$u.toast('电话号码不能为空')
return false
} else if(!this.$u.test.mobile(this.mobile)) {
this.$u.toast('电话号码格式错误')
return false
}
return true
},
validateForm() {
if(this.$u.test.isEmpty(this.name)) {
this.$u.toast('收货人姓名不能为空')
return false
}
if(!this.verifyMobile()) {
return false
}
if(this.$u.test.isEmpty(this.region)) {
this.$u.toast('所在地区不能为空')
return false
}
if(this.$u.test.isEmpty(this.address)) {
this.$u.toast('详细地址不能为空')
return false
}
return true
},
async submitForm() { async submitForm() {
if(!this.validateForm()) {
return false
}
if (this.siteType === 'add') { if (this.siteType === 'add') {
} else if (this.siteType === 'select') { } else if (this.siteType === 'select') {
this.commitSite() this.commitSite()
} else if (this.siteType === 'edit') { } else if (this.siteType === 'edit') {
if (this.$u.test.isEmpty(this.siteInfo)) { if (this.$u.test.isEmpty(this.siteInfo)) {
let params = { let params = {
type: this.type, updateFlag: true,
provinceName: this.region[0],
cityName: this.region[1],
districtName: this.region[2],
address: this.region.join("") + this.address address: this.region.join("") + this.address
}; };
let res = await this.$u.api.syncAddress(params); let res = await this.$u.api.updateAddress(params);
const callback = (vm, res) => { if (res && res.code == 200) {
this.$u.route({ type: 'back' }); this.$u.route({ type: 'back' });
this.show = false this.show = false
};
if (res && res.code == 200) {
getApp().getBaseInfo(this, callback);
} }
} else { } else {
...@@ -258,6 +305,9 @@ export default { ...@@ -258,6 +305,9 @@ export default {
} }
}, },
commitSite() { commitSite() {
if(!this.validateForm()) {
return false
}
// 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
var pages = getCurrentPages(); var pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面 var prevPage = pages[pages.length - 2]; //上一个页面
......
...@@ -28,13 +28,17 @@ export default { ...@@ -28,13 +28,17 @@ export default {
return this.vuex_settled && this.vuex_settled.record || null return this.vuex_settled && this.vuex_settled.record || null
}, },
hasAdderss() { hasAdderss() {
return this.settled && this.settled.address && this.settled.id_card_name return this.settled && this.address && this.settled.id_card_name
},
settledName() {
return this.settled.id_card_name || this.settled.nickname || this.settled.name
}, },
addressInfo() { addressInfo() {
return { return {
name: this.settled.id_card_name || this.settled.nickname || this.settled.name, name: this.settledName,
mobile: this.settled.mobile, mobile: this.settled.mobile,
address: this.settled.address address: this.address,
region: this.region || [],
} }
} }
}, },
...@@ -45,13 +49,12 @@ export default { ...@@ -45,13 +49,12 @@ export default {
if(!this.vuex_token) { if(!this.vuex_token) {
this.$u.route({url: 'pages/login/index'}) this.$u.route({url: 'pages/login/index'})
} else if(!this.settled) { } else if(!this.settled) {
this.getData(); app.getBaseInfo(this);
} }
this.getData();
}, },
methods: { methods: {
getData() { getData() {
let self = this
app.getBaseInfo(self);
this.getMineSite() this.getMineSite()
}, },
getMineSite() { getMineSite() {
...@@ -67,11 +70,17 @@ export default { ...@@ -67,11 +70,17 @@ export default {
}) })
}, },
toAddSite(title){ toAddSite(title){
const info = this.addressInfo
const region = this.region.join('-')
this.$u.route({ this.$u.route({
url: 'pages/mine/address/addSite', url: 'pages/mine/address/addSite',
// params: { params: {
// title: title type: 'edit',
// } name: info.name,
mobile: info.mobile,
region: region,
address: info.address
}
}) })
} }
} }
......
...@@ -21,16 +21,9 @@ ...@@ -21,16 +21,9 @@
</view> </view>
</view> </view>
<view class="detail-view"> <view class="detail-view">
<view class="list-content"> <view class="list-content">
<view class="list-item" v-for="(item, index) in info.items" :key="index"> <view class="list-item" v-for="(item, index) in info.items" :key="index">
<view class="left-view"> <SpareCell :item="item" :noteText="noteText"/>
<image class="image-view" :src="imageUrl(item)"></image>
<view class="info-view">
<view class="name-text">{{item.name}}</view>
<view>{{noteText}}</view>
</view>
</view>
<view class="count-view">x{{item.quantity}}</view>
</view> </view>
</view> </view>
<view class="line-view"></view> <view class="line-view"></view>
...@@ -59,8 +52,12 @@ ...@@ -59,8 +52,12 @@
</view> </view>
</template> </template>
<script> <script>
export default { import SpareCell from "@/components/parts/spareCell.vue"
export default {
components: {
SpareCell
},
data() { data() {
return { return {
info: { info: {
...@@ -163,7 +160,7 @@ ...@@ -163,7 +160,7 @@
}) })
}, },
imageUrl(item) { imageUrl(item) {
return item.images ? item.images.split(',').shift() : this.placeholderImage return item.images ? process.uniEnv.systemUrl.apiUrl + item.images.split(',').shift() : this.placeholderImage
}, },
handleLongpress(key, text) { // 长按复制单号 handleLongpress(key, text) { // 长按复制单号
if (key == 'orderNumber') { if (key == 'orderNumber') {
...@@ -267,45 +264,11 @@ ...@@ -267,45 +264,11 @@
} }
.list-content { .list-content {
margin-top: 40rpx; margin-top: 10rpx;
margin-bottom: 40rpx; margin-bottom: 10rpx;
.list-item { .list-item {
display: flex; margin-bottom: 30rpx;
width: 100%;
margin-right: 30rpx;
justify-content: space-between;
align-items: flex-end;
margin-bottom: 40rpx;
.left-view {
display: flex;
align-items: flex-start;
.image-view {
width: 120rpx;
height: 120rpx;
margin-right: 20rpx;
flex-shrink: 0;
}
.info-view {
font-size: 24rpx;
color: #333333;
.name-text {
font-size: 32rpx;
font-weight: bold;
color: #333333;
margin-bottom: 30rpx;
}
}
}
.count-view {
font-size: 28rpx;
color: #333333;
}
} }
} }
......
This diff is collapsed.
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
<view class="title" v-if="isEmptyParts">配件信息</view> <view class="title" v-if="isEmptyParts">配件信息</view>
<view class="u-flex u-row-between title" v-else> <view class="u-flex u-row-between title" v-else>
<view>选择配件</view> <view>选择配件</view>
<u-icon name="arrow-right" size="24" color="#2272FF" @click="$u.throttle(addParts, 500)" <u-icon name="arrow-right" size="24" color="#2272FF"
label="添加配件" label-pos="left" label-color="#2272FF" label-size="26"/> @click="$u.throttle(addParts, 500)" label="添加配件"
label-pos="left" label-color="#2272FF" label-size="26"/>
</view> </view>
<view class="body"> <view class="body">
<view v-if="isEmptyParts" class="u-flex-col u-col-center list"> <view v-if="isEmptyParts" class="u-flex-col u-col-center list">
...@@ -36,8 +37,7 @@ ...@@ -36,8 +37,7 @@
:bold="false" font-size="26" height="76" :bold="false" font-size="26" height="76"
active-color="#FFFFFF" inactive-color="#333333" active-color="#FFFFFF" inactive-color="#333333"
bg-color="#FFFFFF" button-color="#2272FF" bg-color="#FFFFFF" button-color="#2272FF"
@change="typeChange" @change="typeChange" />
></u-subsection>
</view> </view>
<view class="body"> <view class="body">
<w-address :info="addressInfo" @editSite="editSite" /> <w-address :info="addressInfo" @editSite="editSite" />
...@@ -45,7 +45,9 @@ ...@@ -45,7 +45,9 @@
</view> </view>
</view> </view>
<view class="bottom"> <view class="bottom">
<u-button shape="circle" :disabled="isEmptyParts" :hair-line="false" :custom-style="customStyle" hover-class="none" @click="submitParts">提交</u-button> <u-button shape="circle" :disabled="isEmptyParts"
:hair-line="false" :custom-style="customStyle"
hover-class="none" @click="submitParts">提交</u-button>
</view> </view>
</view> </view>
</template> </template>
...@@ -132,24 +134,19 @@ export default { ...@@ -132,24 +134,19 @@ export default {
}, },
initCustomer() { initCustomer() {
if(this.$u.test.isEmpty(this.order)) { if(this.$u.test.isEmpty(this.order)) {
this.customer = {} this.customer = {name: '', mobile: '', address: '', region: []}
} else { } else {
// this.mine.name = this.order.maintainWorkerName this.mine.name = this.order.maintainWorkerName
// this.mine.mobile = this.order.maintainWorkerPhone this.mine.mobile = this.order.maintainWorkerPhone
this.mine.name = '王先生'
this.mine.mobile = '13045861456'
const region = [
this.order.contactProvinceText,
this.order.contactCityText,
this.order.contactCommunityText,
]
let address = region.join("") + (this.order.contactStreetText || '') + this.order.contactAddress
this.customer = { this.customer = {
name: this.order.contactName, name: this.order.contactName,
mobile: this.order.contactPhone, mobile: this.order.contactPhone,
address: address, address: this.order.contactAddress,
region: region, region: [
this.order.contactProvinceText,
this.order.contactCityText,
this.order.contactCommunityText,
],
} }
} }
}, },
...@@ -160,21 +157,15 @@ export default { ...@@ -160,21 +157,15 @@ export default {
this.curType = index this.curType = index
}, },
editSite() { editSite() {
let region = this.addressInfo.region.join('')
let address = this.addressInfo.address
if(this.$u.test.contains(address, region)) {
address = address.replace(region, '')
}
let params = {
type: 'select',
name: this.addressInfo.name,
mobile: this.addressInfo.mobile,
address: address,
region: this.addressInfo.region.join('-'),
};
this.$u.route({ this.$u.route({
url: "pages/mine/address/addSite", url: "pages/mine/address/addSite",
params: params params: {
type: 'select',
name: this.addressInfo.name,
mobile: this.addressInfo.mobile,
address: this.addressInfo.address,
region: this.addressInfo.region.join('-'),
}
}) })
}, },
updateSite(site) { updateSite(site) {
...@@ -217,7 +208,7 @@ export default { ...@@ -217,7 +208,7 @@ export default {
submitParts() { submitParts() {
const address = this.addressInfo const address = this.addressInfo
let params = { let params = {
workOrderId: orderId, workOrderId: this.orderId,
applyType: this.applyType, applyType: this.applyType,
remark: this.remark, remark: this.remark,
parts: JSON.stringty(parts), parts: JSON.stringty(parts),
......
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