|
@@ -2,14 +2,21 @@
|
|
<view>
|
|
<view>
|
|
<view class="cmain">
|
|
<view class="cmain">
|
|
<view class="form_group">
|
|
<view class="form_group">
|
|
- <view class="lable re">海关申报单号</view>
|
|
|
|
- <input placeholder="请输入" v-model="item.declareOdd" />
|
|
|
|
|
|
+ <view class="lable re">贸易区域</view>
|
|
|
|
+ <picker :range="tradeAreaList" @change="pickerTradeArea($event)" range-key="name">
|
|
|
|
+ <input placeholder="请选择" v-model="item.tradeAreaName" :disabled="true" />
|
|
|
|
+ <view class="icon more"></view>
|
|
|
|
+ </picker>
|
|
</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.goodsName" />
|
|
|
|
|
|
+ <picker v-if="flag === '新增商品'" :range="goodsList" @change="pickerGoods($event)" range-key="name">
|
|
|
|
+ <input placeholder="请选择" v-model="item.goodsName" :disabled="true" />
|
|
|
|
+ <view class="icon more"></view>
|
|
|
|
+ </picker>
|
|
|
|
+ <input v-else placeholder="请选择" v-model="item.goodsName" :disabled="true" 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.placeOrigin" />
|
|
<input placeholder="请输入" v-model="item.placeOrigin" />
|
|
</view>
|
|
</view>
|
|
@@ -26,7 +33,7 @@
|
|
<input placeholder="请选择" v-model="item.goodsUnits" :disabled="true" />
|
|
<input placeholder="请选择" v-model="item.goodsUnits" :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>
|
|
<input type="number" placeholder="请输入" v-model="item.price" />
|
|
<input type="number" placeholder="请输入" v-model="item.price" />
|
|
@@ -54,10 +61,10 @@
|
|
<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>
|
|
<textarea v-model="item.description" placeholder="请输入"></textarea>
|
|
<textarea v-model="item.description" placeholder="请输入"></textarea>
|
|
- </view>
|
|
|
|
|
|
+ </view> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
@@ -66,16 +73,20 @@
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ flag: '新增商品',
|
|
item: {},
|
|
item: {},
|
|
dict: {
|
|
dict: {
|
|
goodsType: ['水果', '药品', '茶叶'],
|
|
goodsType: ['水果', '药品', '茶叶'],
|
|
goodsUnits: ['吨', '个', '柜'],
|
|
goodsUnits: ['吨', '个', '柜'],
|
|
goodsStatus: ['在售', '下架']
|
|
goodsStatus: ['在售', '下架']
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ goodsList: [],
|
|
|
|
+ tradeAreaList: []
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onLoad(e) {
|
|
onLoad(e) {
|
|
if (e.id) {
|
|
if (e.id) {
|
|
|
|
+ this.flag = '编辑商品'
|
|
this.http.request({
|
|
this.http.request({
|
|
url: '/level-one-server/app/TbGoodsTransit/getById?id=' + e.id,
|
|
url: '/level-one-server/app/TbGoodsTransit/getById?id=' + e.id,
|
|
success: res => {
|
|
success: res => {
|
|
@@ -83,26 +94,67 @@ export default {
|
|
uni.setNavigationBarTitle({ title: '编辑商品' });
|
|
uni.setNavigationBarTitle({ title: '编辑商品' });
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
+ this.getGoodsList();
|
|
|
|
+ this.getTradeAreaList();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
picker(e, tag) {
|
|
picker(e, tag) {
|
|
this.item[tag] = this.dict[tag][e.detail.value];
|
|
this.item[tag] = this.dict[tag][e.detail.value];
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
|
|
+ },
|
|
|
|
+ pickerGoods(e) {
|
|
|
|
+ this.item['goodsName'] = this.goodsList[e.detail.value].name;
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ if(this.flag == '新增商品') {
|
|
|
|
+ this.item.id = this.goodsList[e.detail.value].id;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ pickerTradeArea(e) {
|
|
|
|
+ this.item['tradeAreaName'] = this.tradeAreaList[e.detail.value].name;
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ this.item.tradeAreaId = this.tradeAreaList[e.detail.value].id;
|
|
|
|
+ },
|
|
|
|
+ // 获取监管商品列表
|
|
|
|
+ getGoodsList() {
|
|
|
|
+ this.http.request({
|
|
|
|
+ url: '/level-one-server/app/TbGoods/getList',
|
|
|
|
+ method: 'POST',
|
|
|
|
+ success: res => {
|
|
|
|
+ this.goodsList = res.data.data;
|
|
|
|
+ console.log("监管商品列表",this.goodsList);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 获取贸易区域列表
|
|
|
|
+ getTradeAreaList() {
|
|
|
|
+ this.http.request({
|
|
|
|
+ url: '/level-one-server/app/TbTradeArea/getList',
|
|
|
|
+ method: 'POST',
|
|
|
|
+ success: res => {
|
|
|
|
+ this.tradeAreaList = res.data.data;
|
|
|
|
+ console.log("贸易区域列表",this.tradeAreaList);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onNavigationBarButtonTap() {
|
|
onNavigationBarButtonTap() {
|
|
let rule = [
|
|
let rule = [
|
|
{ name: 'goodsName', checkType: 'notnull', errorMsg: '请输入商品名称' },
|
|
{ name: 'goodsName', checkType: 'notnull', errorMsg: '请输入商品名称' },
|
|
- { name: 'placeOrigin', checkType: 'notnull', errorMsg: '请输入商品产地' },
|
|
|
|
{ name: 'goodsStatus', checkType: 'notnull', errorMsg: '请选择状态' }
|
|
{ name: 'goodsStatus', 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;
|
|
}
|
|
}
|
|
|
|
+ let url = '';
|
|
|
|
+ if(this.flag == '新增商品') {
|
|
|
|
+ url = '/level-one-server/app/TbGoodsTransit/transactionGoods';
|
|
|
|
+ } else {
|
|
|
|
+ url = '/level-one-server/app/TbGoodsTransit/update';
|
|
|
|
+ }
|
|
this.http.request({
|
|
this.http.request({
|
|
- url: '/level-one-server/app/TbGoodsTransit/transactionGoods',
|
|
|
|
|
|
+ url: url,
|
|
method: 'POST',
|
|
method: 'POST',
|
|
data: this.item,
|
|
data: this.item,
|
|
success: res => {
|
|
success: res => {
|