|
@@ -6,9 +6,31 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ // * 商品品牌:下拉选择
|
|
|
+ // * 单位:下拉选择
|
|
|
+ // * 商品货号:系统自动生成(只读)
|
|
|
+ // * 批发价
|
|
|
+ // * 零售价
|
|
|
+ // * 库存
|
|
|
+ // * 状态:现售产品有上架、下架状态
|
|
|
+ // * 发售时间:不能低于当前创建时间
|
|
|
form: {
|
|
|
- 'photo': []
|
|
|
- }
|
|
|
+ 'product_img_url': [], // 商品主图
|
|
|
+ 'product_rotation_img_list': [], // 商品轮播图
|
|
|
+ 'product_detail_img_list': [], // 详情图
|
|
|
+ 'product_title': '测试商品', // 商品标题
|
|
|
+ 'product_category_id': 1, // 分类ID
|
|
|
+ 'product_brand_id': 1, // 品牌ID
|
|
|
+ 'product_spec': 'xl', // 规格
|
|
|
+ 'product_unit': '个', // 单位
|
|
|
+ 'product_all_price': 10000, // 批发价
|
|
|
+ 'product_price': 9000, // 零售价
|
|
|
+ 'product_count': 1000, // 库存
|
|
|
+ 'product_sale_at': 0 // 预售时间(0代表预售)
|
|
|
+ },
|
|
|
+ product_img_url_max: 1,
|
|
|
+ product_rotation_img_list_max: 5,
|
|
|
+ product_detail_img_list_max: 5
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -67,6 +89,36 @@ Page({
|
|
|
|
|
|
},
|
|
|
...uploadJS,
|
|
|
+ uploadCallBack(res) {
|
|
|
+ const temp = res.map(item => {
|
|
|
+ return {
|
|
|
+ 'url': item.url,
|
|
|
+ 'formkey': item.formkey
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let tempForm = {}
|
|
|
+ let formkey = ''
|
|
|
+ if (temp.length > 0) {
|
|
|
+ formkey = temp[0].formkey
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (formkey) {
|
|
|
+ case 'product_img_url':
|
|
|
+ tempForm[`form.${formkey}`] = temp
|
|
|
+ break
|
|
|
+ case 'product_rotation_img_list':
|
|
|
+ case 'product_detail_img_list':
|
|
|
+ tempForm[`form.${formkey}`] = this.data.form[formkey].concat(...temp)
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(tempForm)
|
|
|
+
|
|
|
+ if (Object.keys(tempForm).length > 0) {
|
|
|
+ this.setData(tempForm)
|
|
|
+ }
|
|
|
+ },
|
|
|
onSubmit(e) {
|
|
|
console.log(e.detail)
|
|
|
}
|