| | |
| | | <u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules"> |
| | | |
| | | <u-form-item label="商品分类" label-width="130" prop=""> |
| | | <picker @change="bindCategoryChange" :value="index" :range="categoryArray"> |
| | | <view class="uni-input">{{categoryArray[index]}}</view> |
| | | <picker @change="bindCategoryChange" :value="c_index" :range="categoryArray" :range-key="'name'"> |
| | | <view class="uni-input">{{ categoryArray[c_index].name }}</view> |
| | | </picker> |
| | | </u-form-item> |
| | | |
| | | <u-form-item class="border" label="商品名称" label-width="130" prop="name"> |
| | | <u-input v-model="form.name" clearable placeholder="请输入商品名称" /> |
| | | <u-form-item class="border" label="商品名称" label-width="130" prop="goodsName"> |
| | | <u-input v-model="form.goodsName" clearable placeholder="请输入商品名称" /> |
| | | </u-form-item> |
| | | |
| | | <u-form-item label="商品价格" label-width="130" prop="mobile"> |
| | | <u-input v-model="form.mobile" type="number" maxlength="11" placeholder="请输入商品价格" /> |
| | | <u-form-item label="商品价格" label-width="130" prop="price"> |
| | | <u-input v-model="form.price" type="number" placeholder="请输入商品价格" /> |
| | | </u-form-item> |
| | | <u-form-item class="detailgoods" label="详细地址" label-width="130" prop="detail"> |
| | | <u-input type="textarea" v-model="form.detail" maxlength="100" height="150" placeholder="街道楼牌号等" /> |
| | | </u-form-item> |
| | | |
| | | <u-form-item label="商品卖点" label-width="130"> |
| | | <u-input type="textarea" v-model="form.alias" placeholder="请输入商品卖点" /> |
| | | <u-input type="textarea" v-model="form.sellingPoint" placeholder="请输入商品卖点" /> |
| | | </u-form-item> |
| | | |
| | | <u-form-item label="商品品牌" label-width="130" prop=""> |
| | | <div @click="showBrands"> |
| | | {{ form.___path || '请选择品牌' }} |
| | | </div> |
| | | <picker @change="bindBrandsChange" :value="b_index" :range="brandsArray" :range-key="'name'"> |
| | | <view class="uni-input">{{ brandsArray[b_index].name }}</view> |
| | | </picker> |
| | | </u-form-item> |
| | | |
| | | <u-form-item label="计量单位" label-width="130" prop="___path"> |
| | | <div @click="showUnit"> |
| | | {{ form.___path || '请选择所在地区' }} |
| | | </div> |
| | | <picker @change="bindUnitChange" :value="u_index" :range="unitArray" :range-key="'name'"> |
| | | <view class="uni-input">{{ unitArray[u_index].name }}</view> |
| | | </picker> |
| | | </u-form-item> |
| | | <u-form-item label="销售模式" label-width="130" prop="___path"> |
| | | <radio-group name="radio"> |
| | | <label> |
| | | <radio value="radio1" /><text>零售型</text> |
| | | </label> |
| | | <label> |
| | | <radio value="radio2" /><text>批发型</text> |
| | | </label> |
| | | </radio-group> |
| | | </u-form-item> |
| | | |
| | | |
| | | |
| | | <view class="opt-view"> |
| | |
| | | import UFormItem from '@/uview-components/uview-ui/components/u-form-item/u-form-item.vue'; |
| | | import UInput from '@/uview-components/uview-ui/components/u-input/u-input.vue'; |
| | | import UUpload from '@/uview-components/uview-ui/components/u-upload/u-upload.vue'; |
| | | import UCheckboxGroup from '@/uview-components/uview-ui/components/u-checkbox-group/u-checkbox-group.vue'; |
| | | import UCheckbox from '@/uview-components/uview-ui/components/u-checkbox/u-checkbox.vue'; |
| | | // import UCheckboxGroup from '@/uview-components/uview-ui/components/u-checkbox-group/u-checkbox-group.vue'; |
| | | // import UCheckbox from '@/uview-components/uview-ui/components/u-checkbox/u-checkbox.vue'; |
| | | import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue'; |
| | | |
| | | |
| | | import storage from "@/utils/storage.js"; |
| | | import * as API_GOODS from "@/api/goods.js"; |
| | | export default { |
| | | components: { UForm, UFormItem, UInput, UUpload, UCheckboxGroup, UCheckbox, UIcon }, |
| | | components: { UForm, UFormItem, UInput, UUpload, UIcon }, |
| | | data() { |
| | | return { |
| | | c_index: 0, |
| | | b_index: 0, |
| | | u_index: 0, |
| | | storage, |
| | | form: {}, |
| | | categoryArray:[], |
| | | brandsArray:[], |
| | | unitArray:[] |
| | | categoryArray: [], |
| | | brandsArray: [], |
| | | unitArray: [] |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | }); |
| | | this.form.images = images; |
| | | }, |
| | | bindCategoryChange(){}, |
| | | bindBrandsChange(){}, |
| | | bindUnitChange(){}, |
| | | initCategory(){ |
| | | bindCategoryChange(e) { |
| | | this.c_index = e.detail.value |
| | | console.log('this.c_index', this.c_index); |
| | | |
| | | this.initBrands(this.categoryArray[this.c_index].id) |
| | | }, |
| | | bindBrandsChange(e) { |
| | | this.b_index = e.detail.value |
| | | this.form.brandId = this.brandsArray[this.b_index].id |
| | | }, |
| | | bindUnitChange(e) { |
| | | this.u_index = e.detail.value |
| | | this.form.goodsUnit = this.unitArray[this.u_index].name |
| | | }, |
| | | initCategory() { |
| | | API_GOODS.getStoreGoodsCategory().then((res) => { |
| | | const params = res.data.result; |
| | | this.categoryArray = params |
| | | if(params.length>0){ |
| | | if (params && params.length > 0) { |
| | | this.initBrands(params[0].id) |
| | | } |
| | | }); |
| | | }, |
| | | initBrands(categoryId){ |
| | | initBrands(categoryId) { |
| | | this.brandsArray = [] |
| | | API_GOODS.getStoreGoodsBrands(categoryId).then((res) => { |
| | | const params = res.data.result; |
| | | const params = res.data; |
| | | this.brandsArray = params |
| | | }); |
| | | }, |
| | | initGoods(){ |
| | | initGoods() { |
| | | API_GOODS.getgoodsUnit().then((res) => { |
| | | const params = res.data.result; |
| | | const params = res.data.result.records; |
| | | |
| | | this.unitArray = params |
| | | }); |
| | | }, |
| | |
| | | onShow() { |
| | | this.initGoods() |
| | | this.initCategory() |
| | | |
| | | |
| | | }, |
| | | onLoad(option) { |
| | | uni.showLoading({ |