|
|
@@ -40,6 +40,12 @@
|
|
|
<text class="form-label">商品描述</text>
|
|
|
<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">
|
|
|
@@ -74,7 +80,8 @@ export default {
|
|
|
stock: 0,
|
|
|
coverImage: '',
|
|
|
intro: '',
|
|
|
- description: ''
|
|
|
+ description: '',
|
|
|
+ vendorVisible: false
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -93,6 +100,9 @@ export default {
|
|
|
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 => {
|
|
|
@@ -106,6 +116,7 @@ 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
|
|
|
@@ -138,7 +149,8 @@ export default {
|
|
|
stock: Number(this.form.stock),
|
|
|
coverImage: this.form.coverImage || '',
|
|
|
intro: this.form.intro || '',
|
|
|
- description: this.form.description || ''
|
|
|
+ description: this.form.description || '',
|
|
|
+ vendorVisible: this.form.vendorVisible
|
|
|
}
|
|
|
var apiCall = this.isEdit
|
|
|
? productUpdate(Object.assign({ id: this.productId }, data))
|
|
|
@@ -209,6 +221,17 @@ export default {
|
|
|
background: #fafafa;
|
|
|
resize: none;
|
|
|
}
|
|
|
+.form-hint {
|
|
|
+ display: block;
|
|
|
+ font-size: 22rpx;
|
|
|
+ color: #999;
|
|
|
+ margin-top: 8rpx;
|
|
|
+ line-height: 1.5;
|
|
|
+}
|
|
|
+.form-item switch {
|
|
|
+ float: right;
|
|
|
+ margin-top: 6rpx;
|
|
|
+}
|
|
|
.form-picker {
|
|
|
height: 80rpx;
|
|
|
padding: 0 24rpx;
|