|
|
@@ -1,6 +1,6 @@
|
|
|
<config>
|
|
|
{
|
|
|
-'navigationBarTitleText': '新增需求/成交单',
|
|
|
+'navigationBarTitleText': '',
|
|
|
"usingComponents": {
|
|
|
"van-datetime-picker": "../native/vant/datetime-picker/index"
|
|
|
}
|
|
|
@@ -20,10 +20,10 @@
|
|
|
<div class="page-input">
|
|
|
<input
|
|
|
type="text"
|
|
|
- @input="form.name = $event.detail.value"
|
|
|
- @confirm="form.name = $event.detail.value"
|
|
|
- @blur="form.name = $event.detail.value"
|
|
|
- :value="form.name"
|
|
|
+ @input="form.chName = $event.detail.value"
|
|
|
+ @confirm="form.chName = $event.detail.value"
|
|
|
+ @blur="form.chName = $event.detail.value"
|
|
|
+ :value="form.chName"
|
|
|
class="text"
|
|
|
:placeholder="$t('qing-shu-ru-chan-pin-ming-cheng')"
|
|
|
placeholder-class="pla-textarea"
|
|
|
@@ -65,17 +65,14 @@
|
|
|
|
|
|
<div class="page-info">
|
|
|
<h3>{{ $t('chan-pin-lei-bie') }}</h3>
|
|
|
- <div class="page-input">
|
|
|
- <input
|
|
|
- type="text"
|
|
|
- @input="form.customCategory = $event.detail.value"
|
|
|
- @confirm="form.customCategory = $event.detail.value"
|
|
|
- @blur="form.customCategory = $event.detail.value"
|
|
|
- :value="form.customCategory"
|
|
|
- class="text"
|
|
|
- :placeholder="$t('qing-shu-ru-chan-pin-lei-bie')"
|
|
|
- placeholder-class="pla-textarea"
|
|
|
- />
|
|
|
+ <div class="page-input" @click="$refs.productCategory.show()">
|
|
|
+ <div class="text">
|
|
|
+ <product-category-select
|
|
|
+ ref="productCategory"
|
|
|
+ v-model="form.productCategoryId"
|
|
|
+ ></product-category-select>
|
|
|
+ </div>
|
|
|
+ <van-icon name="arrow" color="#CCD0DC" :size="24" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -104,10 +101,6 @@
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
- <div class="del-btn" v-if="orderId">
|
|
|
- <van-button block plain size="small" :color="$colors.info" @click="del">删除</van-button>
|
|
|
- </div>
|
|
|
-
|
|
|
<div class="page-info">
|
|
|
<h3>{{ $t('jiao-yi-gong-si') }}</h3>
|
|
|
<div class="page-input">
|
|
|
@@ -124,6 +117,109 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
+ <div class="page-info">
|
|
|
+ <h3>{{ $t('jiao-yi-shi-jian') }}</h3>
|
|
|
+ <div class="page-input" @click="selectTime">
|
|
|
+ <span class="text" v-if="form.transactionTime">{{ form.transactionTime }}</span>
|
|
|
+ <span class="pla-textarea flex1" v-else>{{ $t('qing-xuan-ze-jiao-yi-shi-jian') }}</span>
|
|
|
+ <van-icon name="arrow" color="#CCD0DC" :size="24" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="page-info">
|
|
|
+ <h3>{{ $t('jiao-yi-jia-ge') }}</h3>
|
|
|
+ <div class="page-input">
|
|
|
+ <span class="pre">$</span>
|
|
|
+ <input
|
|
|
+ type="digit"
|
|
|
+ @input="form.price = $event.detail.value"
|
|
|
+ @confirm="changePrice"
|
|
|
+ @blur="changePrice"
|
|
|
+ :value="form.price"
|
|
|
+ class="text"
|
|
|
+ placeholder="0.00"
|
|
|
+ placeholder-class="pla-textarea"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="page-info" v-if="orderId">
|
|
|
+ <h3>{{ $t('bian-hao') }}</h3>
|
|
|
+ <div class="page-input">
|
|
|
+ <span class="text">{{ form.number }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="page-info">
|
|
|
+ <h3>{{ $t('hai-guan-bian-ma') }}</h3>
|
|
|
+ <div class="page-input">
|
|
|
+ <input
|
|
|
+ type="number"
|
|
|
+ @input="form.customsHsCode = $event.detail.value"
|
|
|
+ @confirm="form.customsHsCode = $event.detail.value"
|
|
|
+ @blur="form.customsHsCode = $event.detail.value"
|
|
|
+ :value="form.customsHsCode"
|
|
|
+ class="text"
|
|
|
+ placeholder-class="pla-textarea"
|
|
|
+ :placeholder="$t('qing-shu-ru-10-wei-hai-guan-bian-ma')"
|
|
|
+ :maxlength="10"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="page-info">
|
|
|
+ <h3>{{ $t('jin-jing-bei-an-dan-hao') }}</h3>
|
|
|
+ <div class="page-input">
|
|
|
+ <input
|
|
|
+ type="number"
|
|
|
+ @input="form.entryRecordNumber = $event.detail.value"
|
|
|
+ @confirm="form.entryRecordNumber = $event.detail.value"
|
|
|
+ @blur="form.entryRecordNumber = $event.detail.value"
|
|
|
+ :value="form.entryRecordNumber"
|
|
|
+ class="text"
|
|
|
+ placeholder-class="pla-textarea"
|
|
|
+ :placeholder="$t('qing-shu-ru-18-wei-bian-hao')"
|
|
|
+ :maxlength="18"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="page-info">
|
|
|
+ <h3>{{ $t('jin-kou-bao-guan-dan-hao') }}</h3>
|
|
|
+ <div class="page-input">
|
|
|
+ <input
|
|
|
+ type="number"
|
|
|
+ @input="form.importDeclarationNumber = $event.detail.value"
|
|
|
+ @confirm="form.importDeclarationNumber = $event.detail.value"
|
|
|
+ @blur="form.importDeclarationNumber = $event.detail.value"
|
|
|
+ :value="form.importDeclarationNumber"
|
|
|
+ class="text"
|
|
|
+ placeholder-class="pla-textarea"
|
|
|
+ :placeholder="$t('qing-shu-ru-18-wei-bian-hao')"
|
|
|
+ :maxlength="18"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="page-info">
|
|
|
+ <h3>{{ $t('chu-jing-bei-an-dan-hao') }}</h3>
|
|
|
+ <div class="page-input">
|
|
|
+ <input
|
|
|
+ type="number"
|
|
|
+ @input="form.exitRecordNumber = $event.detail.value"
|
|
|
+ @confirm="form.exitRecordNumber = $event.detail.value"
|
|
|
+ @blur="form.exitRecordNumber = $event.detail.value"
|
|
|
+ :value="form.exitRecordNumber"
|
|
|
+ class="text"
|
|
|
+ placeholder-class="pla-textarea"
|
|
|
+ :placeholder="$t('qing-shu-ru-18-wei-bian-hao')"
|
|
|
+ :maxlength="18"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="del-btn" v-if="orderId">
|
|
|
+ <van-button block plain size="small" :color="$colors.info" @click="del">删除</van-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
<fixed-button>
|
|
|
<van-button block @click="submit" :color="$colors.warn" :disabled="!canNext">{{
|
|
|
orderId ? $t('bao-cun') : $t('ti-jiao')
|
|
|
@@ -135,7 +231,7 @@
|
|
|
<div class="bar">
|
|
|
<van-icon color="#5E636D" :size="24" name="cross" @click="showTime = false" />
|
|
|
<h3></h3>
|
|
|
- <van-button :color="$colors.warn" plain @click="changeTime">{{ $t('que-ding') }}</van-button>
|
|
|
+ <van-button :color="$colors.warn" plain @click="sureTime">{{ $t('que-ding') }}</van-button>
|
|
|
</div>
|
|
|
<van-datetime-picker :show-toolbar="false" type="datetime" :value="nowTime" @input="changeTime" />
|
|
|
</van-popup>
|
|
|
@@ -152,17 +248,15 @@ export default {
|
|
|
return {
|
|
|
orderId: 0,
|
|
|
form: {
|
|
|
- type: 'OWN_PRODUCT',
|
|
|
- name: '',
|
|
|
+ chName: '',
|
|
|
brand: '',
|
|
|
model: '',
|
|
|
- customCategory: '',
|
|
|
- productCategoryId: '',
|
|
|
applicationField: [],
|
|
|
- introduction: ''
|
|
|
+ introduction: '',
|
|
|
+ price: ''
|
|
|
},
|
|
|
isVendor: false,
|
|
|
- showTime: true,
|
|
|
+ showTime: false,
|
|
|
nowTime: ''
|
|
|
};
|
|
|
},
|
|
|
@@ -176,12 +270,17 @@ export default {
|
|
|
},
|
|
|
canNext() {
|
|
|
if (
|
|
|
- this.form.type &&
|
|
|
- this.form.name &&
|
|
|
+ this.form.chName &&
|
|
|
this.form.brand &&
|
|
|
- this.form.productCategoryId &&
|
|
|
this.form.introduction &&
|
|
|
- this.form.applicationField.length > 0
|
|
|
+ this.form.applicationField.length > 0 &&
|
|
|
+ this.form.exitRecordNumber &&
|
|
|
+ this.form.importDeclarationNumber &&
|
|
|
+ this.form.entryRecordNumber &&
|
|
|
+ this.form.customsHsCode &&
|
|
|
+ this.form.price &&
|
|
|
+ this.form.transactionTime &&
|
|
|
+ this.form.transactionCompany
|
|
|
) {
|
|
|
return true;
|
|
|
} else {
|
|
|
@@ -190,15 +289,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- if (this.$store.state.userInfo && this.$store.state.userInfo.identity !== 'BUYERS') {
|
|
|
- this.isVendor = true;
|
|
|
- } else {
|
|
|
- this.isVendor = false;
|
|
|
- }
|
|
|
+ wx.setNavigationBarTitle({
|
|
|
+ title: this.$t('xin-zeng-xu-qiu-cheng-jiao-dan')
|
|
|
+ });
|
|
|
if (options.id) {
|
|
|
this.orderId = options.id;
|
|
|
this.$http
|
|
|
- .get('/productList/get/' + options.id)
|
|
|
+ .get('/productsTransaction/get/' + options.id)
|
|
|
.then(res => {
|
|
|
delete res.productCategory;
|
|
|
this.form = res;
|
|
|
@@ -208,41 +305,11 @@ export default {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- if (options.type) {
|
|
|
- this.form.type = options.type;
|
|
|
- }
|
|
|
},
|
|
|
methods: {
|
|
|
- chooseType() {
|
|
|
- if (this.form.id) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const types = [...productListType].filter(item => {
|
|
|
- if (this.isVendor && item[0] === 'OWN_PRODUCT') {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
- }
|
|
|
- });
|
|
|
- const _list = [...types].map(item => {
|
|
|
- console.log(item);
|
|
|
-
|
|
|
- return this.$t(item[1]);
|
|
|
- });
|
|
|
- wx.showActionSheet({
|
|
|
- itemList: _list,
|
|
|
- success: res => {
|
|
|
- this.form.type = [...types][res.tapIndex][0];
|
|
|
- },
|
|
|
- fail: res => {
|
|
|
- console.log(res.errMsg);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
submit() {
|
|
|
const form = { ...this.form };
|
|
|
- if (!form.name) {
|
|
|
+ if (!form.chName) {
|
|
|
this.toast(this.$t('qing-shu-ru-chan-pin-ming-cheng'));
|
|
|
return;
|
|
|
}
|
|
|
@@ -250,14 +317,7 @@ export default {
|
|
|
this.toast(this.$t('qing-shu-ru-pin-pai-ming-cheng'));
|
|
|
return;
|
|
|
}
|
|
|
- if (this.form.type === 'OWN_PRODUCT' && !form.customCategory) {
|
|
|
- this.toast(this.$t('qing-shu-ru-chan-pin-lei-bie'));
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.form.type !== 'OWN_PRODUCT' && !form.productCategoryId) {
|
|
|
- this.toast(this.$t('qing-xuan-ze-chan-pin-lei-bie'));
|
|
|
- return;
|
|
|
- }
|
|
|
+
|
|
|
if (form.applicationField.length === 0) {
|
|
|
this.toast(this.$t('qing-xuan-ze-ying-yong-ling-yu'));
|
|
|
return;
|
|
|
@@ -266,11 +326,48 @@ export default {
|
|
|
this.toast(this.$t('qing-shu-ru-chan-pin-miao-shu'));
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if (!form.transactionCompany) {
|
|
|
+ this.toast(this.$t('qing-shu-ru-jiao-yi-gong-si'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!form.transactionTime) {
|
|
|
+ this.toast(this.$t('qing-xuan-ze-jiao-yi-shi-jian'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!form.price) {
|
|
|
+ this.toast(this.$t('qing-shu-ru-huo-zhi'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!form.customsHsCode || !/[0-9]{10}/g.test(form.customsHsCode)) {
|
|
|
+ this.toast(this.$t('hai-guan-bian-ma-ge-shi-cuo-wu'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!form.entryRecordNumber || !/[0-9]{18}/g.test(form.entryRecordNumber)) {
|
|
|
+ this.toast(this.$t('qing-shu-ru-18-wei-shu-zi-chu-jing-bei-an-dan-hao'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!form.importDeclarationNumber || !/[0-9]{18}/g.test(form.importDeclarationNumber)) {
|
|
|
+ this.toast(this.$t('qing-shu-ru-18-wei-shu-zi-jin-kou-bao-guan-dan-hao'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!form.exitRecordNumber || !/[0-9]{18}/g.test(form.exitRecordNumber)) {
|
|
|
+ this.toast(this.$t('qing-shu-ru-18-wei-shu-zi-chu-jing-bei-an-dan-hao'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (!form.id) {
|
|
|
form.userId = this.$store.state.userInfo.id;
|
|
|
}
|
|
|
+
|
|
|
this.$http
|
|
|
- .post('/productList/save', form, {
|
|
|
+ .post('/productsTransaction/save', form, {
|
|
|
header: {
|
|
|
'Content-Type': 'application/json'
|
|
|
}
|
|
|
@@ -291,7 +388,7 @@ export default {
|
|
|
del() {
|
|
|
this.dialog(this.$t('que-ren-yao-shan-chu-gai-qing-dan-ma'), true, false, this.$t('li-ji-shan-chu'))
|
|
|
.then(() => {
|
|
|
- return this.$http.post(`/productList/del/${this.orderId}`);
|
|
|
+ return this.$http.post(`/productsTransaction/del/${this.orderId}`);
|
|
|
})
|
|
|
.then(() => {
|
|
|
this.toast(this.$t('shan-chu-cheng-gong'), 'success');
|
|
|
@@ -306,13 +403,27 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
changeTime(e) {
|
|
|
- console.log(e);
|
|
|
- this.nowTime = new Date(e.detail);
|
|
|
+ this.nowTime = e.detail;
|
|
|
+ },
|
|
|
+ changePrice(e) {
|
|
|
+ console.log(e.detail);
|
|
|
+ this.form.price = Number(e.detail.value);
|
|
|
+ },
|
|
|
+ sureTime() {
|
|
|
+ this.form.transactionTime = dayjs(new Date(this.nowTime)).format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ this.showTime = false;
|
|
|
+ },
|
|
|
+ selectTime() {
|
|
|
+ this.showTime = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.nowTime = new Date().getTime();
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
ApplicationSelect,
|
|
|
- FixedButton
|
|
|
+ FixedButton,
|
|
|
+ ProductCategorySelect
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
@@ -339,6 +450,11 @@ export default {
|
|
|
line-height: 22px;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
+
|
|
|
+ .pre {
|
|
|
+ font-size: 14px;
|
|
|
+ padding-right: 5px;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.pla-textarea {
|