|
|
@@ -41,14 +41,7 @@
|
|
|
<textarea class="form-textarea" v-model="form.description" placeholder="商品描述(可选,详细内容)" />
|
|
|
</view>
|
|
|
|
|
|
- <view class="form-item">
|
|
|
- <text class="form-label">仅供应商可见</text>
|
|
|
- <switch :checked="form.vendorVisible" @change="onVendorVisibleChange" color="#F97316" />
|
|
|
- <text class="form-hint">开启后,该商品仅供应商体系内用户可在列表中看到,直接分享链接仍可访问</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view class="form-actions">
|
|
|
+<view class="form-actions">
|
|
|
<button class="btn-submit" :disabled="submitting" @click="onSubmit">
|
|
|
{{ submitting ? '提交中...' : (isEdit ? '保存修改' : '立即发布') }}
|
|
|
</button>
|
|
|
@@ -80,8 +73,7 @@ export default {
|
|
|
stock: 0,
|
|
|
coverImage: '',
|
|
|
intro: '',
|
|
|
- description: '',
|
|
|
- vendorVisible: false
|
|
|
+ description: ''
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -97,13 +89,6 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
onTypeChange(e) {
|
|
|
- this.typeIndex = e.detail.value
|
|
|
- this.form.productType = this.typeOptions[e.detail.value].value
|
|
|
- },
|
|
|
- onVendorVisibleChange(e) {
|
|
|
- this.form.vendorVisible = e.detail.value
|
|
|
- },
|
|
|
- loadProduct(id) {
|
|
|
uni.showLoading({ title: '加载中...' })
|
|
|
productDetail({ id: Number(id) }).then(res => {
|
|
|
uni.hideLoading()
|
|
|
@@ -116,7 +101,6 @@ export default {
|
|
|
this.form.price = p.price || 0
|
|
|
this.form.stock = p.stock || 0
|
|
|
this.form.productType = p.productType || 'physical'
|
|
|
- this.form.vendorVisible = p.vendorVisible === true
|
|
|
// sync picker index
|
|
|
var idx = this.typeOptions.findIndex(function(t) { return t.value === this.form.productType }, this)
|
|
|
if (idx >= 0) this.typeIndex = idx
|
|
|
@@ -149,8 +133,7 @@ export default {
|
|
|
stock: Number(this.form.stock),
|
|
|
coverImage: this.form.coverImage || '',
|
|
|
intro: this.form.intro || '',
|
|
|
- description: this.form.description || '',
|
|
|
- vendorVisible: this.form.vendorVisible
|
|
|
+ description: this.form.description || ''
|
|
|
}
|
|
|
var apiCall = this.isEdit
|
|
|
? productUpdate(Object.assign({ id: this.productId }, data))
|