|
@@ -1,50 +1,52 @@
|
|
<template>
|
|
<template>
|
|
<view>
|
|
<view>
|
|
<view class="address" @click="address()">
|
|
<view class="address" @click="address()">
|
|
- <view class="con">
|
|
|
|
- <view class="title omit">云南省普洱市思茅区普洱路云南省普洱市思茅区普洱路36号云南省普洱市思茅区普洱路云南省普洱市思茅区普洱路</view>
|
|
|
|
|
|
+ <view class="con" v-if="item.addressName">
|
|
|
|
+ <view class="title omit">{{ item.addressName }}</view>
|
|
<view class="desc">
|
|
<view class="desc">
|
|
- <text>陈晓东</text>
|
|
|
|
- <text>13481076556</text>
|
|
|
|
|
|
+ <text>{{ item.name }}</text>
|
|
|
|
+ <text>{{ item.phone }}</text>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="con" v-else>
|
|
|
|
+ <view class="title omit">你还没添加收货地址</view>
|
|
|
|
+ <view class="desc">
|
|
|
|
+ <text>点击添加地址</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="icon"></view>
|
|
<view class="icon"></view>
|
|
- <view class="clear"></view>
|
|
|
|
</view>
|
|
</view>
|
|
<view class="forms">
|
|
<view class="forms">
|
|
<view class="form_group">
|
|
<view class="form_group">
|
|
<view class="lable re">互市区</view>
|
|
<view class="lable re">互市区</view>
|
|
- <picker :range="dict.city" @change="picker($event, 'city')">
|
|
|
|
- <input placeholder="请选择" v-model="item.city" :disabled="true" />
|
|
|
|
|
|
+ <picker :range="tradeAreaList" @change="picker($event, 'tradeAreaName')" range-key="name">
|
|
|
|
+ <input placeholder="请选择" v-model="item.tradeAreaName" :disabled="true" />
|
|
<view class="icon more"></view>
|
|
<view class="icon more"></view>
|
|
</picker>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
<view class="form_group">
|
|
<view class="form_group">
|
|
<view class="lable re">收购商品</view>
|
|
<view class="lable re">收购商品</view>
|
|
- <picker :range="dict.city" @change="picker($event, 'city')">
|
|
|
|
- <input placeholder="请选择" v-model="item.city" :disabled="true" />
|
|
|
|
|
|
+ <picker @click="selectGoods()" :disabled="true">
|
|
|
|
+ <input placeholder="请选择" v-model="item.goodsName" :disabled="true" />
|
|
<view class="icon more"></view>
|
|
<view class="icon more"></view>
|
|
</picker>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
<view class="form_group">
|
|
<view class="form_group">
|
|
<view class="lable">商品编号</view>
|
|
<view class="lable">商品编号</view>
|
|
- <input placeholder="请输入" v-model="item.typeCode" />
|
|
|
|
|
|
+ <input placeholder="请输入" v-model="item.goodsNo" />
|
|
</view>
|
|
</view>
|
|
<view class="form_group">
|
|
<view class="form_group">
|
|
<view class="lable re">计价单位</view>
|
|
<view class="lable re">计价单位</view>
|
|
- <picker :range="dict.city" @change="picker($event, 'city')">
|
|
|
|
- <input placeholder="请选择" v-model="item.city" :disabled="true" />
|
|
|
|
- <view class="icon more"></view>
|
|
|
|
- </picker>
|
|
|
|
|
|
+ <input placeholder="请输入" v-model="item.goodsUnit" :disabled="true" />
|
|
</view>
|
|
</view>
|
|
<view class="form_group">
|
|
<view class="form_group">
|
|
<view class="lable re">数量</view>
|
|
<view class="lable re">数量</view>
|
|
- <input placeholder="请输入" v-model="item.typeCode" />
|
|
|
|
|
|
+ <input type="number" placeholder="请输入" v-model="item.goodsQuantity" />
|
|
</view>
|
|
</view>
|
|
<view class="form_group">
|
|
<view class="form_group">
|
|
<view class="lable re">到货日期</view>
|
|
<view class="lable re">到货日期</view>
|
|
- <picker mode="date" @change="picker($event, 'date')">
|
|
|
|
- <input placeholder="请选择" v-model="item.date" :disabled="true" />
|
|
|
|
|
|
+ <picker mode="date" @change="picker($event, 'arrivalTime')">
|
|
|
|
+ <input placeholder="请选择" v-model="item.arrivalTime" :disabled="true" />
|
|
<view class="icon more"></view>
|
|
<view class="icon more"></view>
|
|
</picker>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
@@ -52,63 +54,103 @@
|
|
<view class="mfooter">
|
|
<view class="mfooter">
|
|
<view class="flex">
|
|
<view class="flex">
|
|
<view class="f">
|
|
<view class="f">
|
|
- <button class="save btn" @click="save()">保存</button>
|
|
|
|
|
|
+ <button class="save btn" @click="save(0)">保存</button>
|
|
</view>
|
|
</view>
|
|
<view class="f">
|
|
<view class="f">
|
|
- <button class="btn" @click="save()">一键发布</button>
|
|
|
|
|
|
+ <button class="btn" @click="save(1)">一键发布</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
-
|
|
|
|
<script>
|
|
<script>
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
item: {},
|
|
item: {},
|
|
- dict: {
|
|
|
|
- city: ['东兴市', '贵港市']
|
|
|
|
- }
|
|
|
|
|
|
+ tradeAreaList: []
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onLoad(e) {
|
|
onLoad(e) {
|
|
if (e.id) {
|
|
if (e.id) {
|
|
this.http.request({
|
|
this.http.request({
|
|
- url: '/level-one-server/app/TbPortNews/getPortNewsDetails',
|
|
|
|
- data: { id: e.id },
|
|
|
|
|
|
+ url: '/level-two-server/app/TbGoodsDemand/getById?id=' + e.id,
|
|
success: res => {
|
|
success: res => {
|
|
this.item = res.data.data;
|
|
this.item = res.data.data;
|
|
|
|
+ uni.setNavigationBarTitle({ title: '编辑求购信息' });
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- uni.$on('selectAddress', res => {});
|
|
|
|
|
|
+ this.getTradeAreaList();
|
|
|
|
+ //选择地址回显
|
|
|
|
+ uni.$on('selectAddress', res => {
|
|
|
|
+ this.item.addressName = res.province + ' ' + res.city + ' ' + res.area + ' ' + res.street;
|
|
|
|
+ this.item.name = res.name;
|
|
|
|
+ this.item.phone = res.phone;
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ });
|
|
|
|
+ //选择商品回显
|
|
|
|
+ uni.$on('selects', res => {
|
|
|
|
+ this.item.goodsName = res.name;
|
|
|
|
+ this.item.levelOneGoodsId = res.id;
|
|
|
|
+ this.item.goodsImg = res.avatar;
|
|
|
|
+ this.item.goodsNo = res.code;
|
|
|
|
+ this.item.goodsUnit = res.unit;
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ });
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 获取贸易区域列表
|
|
|
|
+ getTradeAreaList() {
|
|
|
|
+ this.http.request({
|
|
|
|
+ url: '/level-one-server/app/TbTradeArea/getList',
|
|
|
|
+ success: res => {
|
|
|
|
+ this.tradeAreaList = res.data.data;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
//选择地址
|
|
//选择地址
|
|
address() {
|
|
address() {
|
|
uni.navigateTo({ url: '/pages/market/two/purchaser/address/list?select=true' });
|
|
uni.navigateTo({ url: '/pages/market/two/purchaser/address/list?select=true' });
|
|
},
|
|
},
|
|
|
|
+ //选择商品
|
|
|
|
+ selectGoods() {
|
|
|
|
+ if (this.item.tradeAreaId) {
|
|
|
|
+ uni.navigateTo({ url: '/pages/market/one/merchant/goods/selects?tradeAreaId=' + this.item.tradeAreaId + '&tradeAreaName=' + this.item.tradeAreaName });
|
|
|
|
+ } else {
|
|
|
|
+ uni.showModal({ content: '请先选择互市区', showCancel: false });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
picker(e, tag) {
|
|
picker(e, tag) {
|
|
- if (tag == 'date') {
|
|
|
|
|
|
+ if (tag == 'arrivalTime') {
|
|
this.item[tag] = e.detail.value;
|
|
this.item[tag] = e.detail.value;
|
|
- } else {
|
|
|
|
- this.item[tag] = this.dict[tag][e.detail.value];
|
|
|
|
|
|
+ }
|
|
|
|
+ if (tag == 'tradeAreaName') {
|
|
|
|
+ this.item.tradeAreaName = this.tradeAreaList[e.detail.value].name;
|
|
|
|
+ this.item.tradeAreaId = this.tradeAreaList[e.detail.value].id;
|
|
}
|
|
}
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
},
|
|
},
|
|
- save() {
|
|
|
|
- /* let rule = [
|
|
|
|
- { name: 'typeCode', checkType: 'notnull', errorMsg: '请输入编码' },
|
|
|
|
- { name: 'typeName', checkType: 'notnull', errorMsg: '请输入名称' },
|
|
|
|
- { name: 'status', checkType: 'notnull', errorMsg: '请选择状态' }
|
|
|
|
|
|
+ //保存或发布
|
|
|
|
+ save(isRelease) {
|
|
|
|
+ let rule = [
|
|
|
|
+ { name: 'tradeAreaName', checkType: 'notnull', errorMsg: '请选择互市区' },
|
|
|
|
+ { name: 'goodsName', checkType: 'notnull', errorMsg: '请选择商品' },
|
|
|
|
+ { name: 'addressName', checkType: 'notnull', errorMsg: '请选择地址' },
|
|
|
|
+ { name: 'goodsQuantity', checkType: 'notnull', errorMsg: '请输入数量' },
|
|
|
|
+ { name: 'arrivalTime', checkType: 'notnull', errorMsg: '请选择到货日期' }
|
|
];
|
|
];
|
|
if (!this.verify.check(this.item, rule)) {
|
|
if (!this.verify.check(this.item, rule)) {
|
|
uni.showModal({ content: this.verify.error, showCancel: false });
|
|
uni.showModal({ content: this.verify.error, showCancel: false });
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+ this.item.isRelease = isRelease;
|
|
|
|
+ delete this.item.createTime;
|
|
|
|
+ delete this.item.updateTime;
|
|
|
|
+ let action = this.item.id ? 'update' : 'add';
|
|
this.http.request({
|
|
this.http.request({
|
|
- url: '/project/projectType',
|
|
|
|
|
|
+ url: '/level-two-server/app/TbGoodsDemand/' + action,
|
|
method: 'POST',
|
|
method: 'POST',
|
|
data: this.item,
|
|
data: this.item,
|
|
success: res => {
|
|
success: res => {
|
|
@@ -118,7 +160,7 @@ export default {
|
|
uni.navigateBack();
|
|
uni.navigateBack();
|
|
}, 1000);
|
|
}, 1000);
|
|
}
|
|
}
|
|
- }); */
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|