Selaa lähdekoodia

管理端,添加商品时,增加pv split选项

theo 3 vuotta sitten
vanhempi
commit
c10a0906b7
2 muutettua tiedostoa jossa 196 lisäystä ja 188 poistoa
  1. 189 185
      backendEle/src/views/shop/goods-add.vue
  2. 7 3
      common/models/forms/ShopGoodsForm.php

+ 189 - 185
backendEle/src/views/shop/goods-add.vue

@@ -21,6 +21,9 @@
                 <!-- <el-form-item label="复消购买方式">
                     <el-checkbox  v-for="(value,key) in sellType" v-model="form.sellType[key-1]" :key="key" >{{value.name}}</el-checkbox>
                 </el-form-item> -->
+                <el-form-item label="BV split">
+                    <el-checkbox v-model="form.pvSplit"></el-checkbox>
+                </el-form-item>
                 <el-form-item label="Product Category"><!-- 商品分类 -->
                     <el-select v-model="form.categoryType" placeholder="">
                         <el-option v-for="item in categoryType" :key="item.id" :label="item.name" :value="item.id"></el-option>
@@ -83,196 +86,197 @@
 </template>
 
 <script>
-    import store from '@/utils/vuexStore'
-    import network from '@/utils/network'
-    import tool from '@/utils/tool'
-    import baseInfo from '../../utils/baseInfo'
-    import LeoUploader from '@/components/Uploader';
-    export default {
-        name: "goods-add",
-        components:{LeoUploader},
-        mounted () {
-            this.getData();
-            this.getFileToken();
-        },
-        data(){
-            return{
-                dialogImageUrl: '',
-                dialogVisible: false,
-                disabled: false,
-                loading: false,
-                file:null,
-                uploadToken:'',
-                form:{
-                    goodsName:'',
-                    type:'',
-                    giftType:[false,false,false,false],
-                    sellType:[false,false],
-                    goodsNo:'',
-                    unit:'',
-                    marketPrice:'',
-                    sellPrice:'',
-                    pricePv:'',
-                    point:'',
-                    storeNums:'',
-                    content:'',
-                    sort:'',
-                    discount:'',
-                    cover:'',
-                    textarea:'',
-                    sellDiscount:'',
-                    categoryType: '',
-                    sellPriceStandard: '',
-                    taxRate: 0,
-                },
-                submitButtonStat: false,
-                goodsType:[],
-                GiftTypeArr:[],
-                categoryType: [],
-                sellType:null,
-                width:'100px',
-                height:'100px',
-                pvDisabled: true,
-                exchangeRate: baseInfo.exchangeRate(),
-            }
-        },
-        watch:{
-            dialogVisible(newVal,oldVal){
-                console.log(newVal,oldVal)
-            },
-            // 监听商品分类,控制PV是否展示
-            'form.categoryType': {
-                deep: true,
-                handler(modern, origin) {
-                    this.pvDisabled = (parseInt(modern) === 1)
-                }
-            },
-            // 监听商品标准价格,自动计算销售价格
-            // 'form.sellPriceStandard': {
-            //     deep: true,
-            //     handler(modern, origin) {
-            //         this.form.sellPrice = modern * this.exchangeRate
-            //     }
-            // },
-        },
-        methods: {
-            handleRemove(file) {
-                console.log(file);
-            },
-            upLoadSuccess(file){
-                this.form.cover=file;
-            },
-            handlePictureCardPreview(file) {
-                this.dialogImageUrl = file.url;
-                this.dialogVisible = true;
-                this.file=file;
-                // console.log(file);
+import store from '@/utils/vuexStore'
+import network from '@/utils/network'
+import tool from '@/utils/tool'
+import baseInfo from '../../utils/baseInfo'
+import LeoUploader from '@/components/Uploader';
+export default {
+  name: 'goods-add',
+  components: {LeoUploader},
+  mounted () {
+    this.getData();
+    this.getFileToken();
+  },
+  data () {
+    return {
+      dialogImageUrl: '',
+      dialogVisible: false,
+      disabled: false,
+      loading: false,
+      file: null,
+      uploadToken: '',
+      form: {
+        goodsName: '',
+        type: '',
+        giftType: [false,false,false,false],
+        sellType: [false,false],
+        goodsNo: '',
+        unit: '',
+        marketPrice: '',
+        sellPrice: '',
+        pvSplit: '',
+        pricePv: '',
+        point: '',
+        storeNums: '',
+        content: '',
+        sort: '',
+        discount: '',
+        cover: '',
+        textarea: '',
+        sellDiscount: '',
+        categoryType: '',
+        sellPriceStandard: '',
+        taxRate: 0,
+      },
+      submitButtonStat: false,
+      goodsType: [],
+      GiftTypeArr: [],
+      categoryType: [],
+      sellType: null,
+      width: '100px',
+      height: '100px',
+      pvDisabled: true,
+      exchangeRate: baseInfo.exchangeRate(),
+    }
+  },
+  watch: {
+    dialogVisible (newVal,oldVal) {
+      console.log(newVal,oldVal)
+    },
+    // 监听商品分类,控制PV是否展示
+    'form.categoryType': {
+      deep: true,
+      handler (modern, origin) {
+        this.pvDisabled = (parseInt(modern) === 1)
+      }
+    },
+    // 监听商品标准价格,自动计算销售价格
+    // 'form.sellPriceStandard': {
+    //     deep: true,
+    //     handler(modern, origin) {
+    //         this.form.sellPrice = modern * this.exchangeRate
+    //     }
+    // },
+  },
+  methods: {
+    handleRemove (file) {
+      console.log(file);
+    },
+    upLoadSuccess (file) {
+      this.form.cover = file;
+    },
+    handlePictureCardPreview (file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = true;
+      this.file = file;
+      // console.log(file);
 
-            },
-            handleDownload(file) {
-                console.log(file);
-            },
-            getFile(){
-                let data={
-                    uploadToken:this.uploadToken,
-                    file:this.file
-                }
-                if(this.uploadToken){
-                    network.postData('shop/upload',data)
-                    .then(response=>{
-                        console.log(response);
-                    })
-                }
-            },
-            getFileToken(){
-                network.getData('shop/upload').then(response=>{
-                   this.uploadToken=response;
-                })
-            },
-            getData (page, pageSize) {
-                let filterData = this.filterModel
-                let vueObj = this
-                network.getPageData(this, 'shop/goods-add', page, pageSize, this.filterModel, response=>{
-                    this.categoryType = response.categoryType
-                    this.goodsType=response.goodsType
-                    this.GiftTypeArr=response.giftType
-                    this.sellType=response.sellType
-                    // this.form.sellType=this.form.sellType.map((item,index)=>{
-                    //   return response.sellType.some(val=>(index+1).toString()==val)
-                    // })
-                })
-            },
-            addSubmit() {
-                this.submitButtonStat = true
-                let path = 'shop/goods-add';
+    },
+    handleDownload (file) {
+      console.log(file);
+    },
+    getFile () {
+      let data = {
+        uploadToken: this.uploadToken,
+        file: this.file
+      }
+      if (this.uploadToken) {
+        network.postData('shop/upload', data)
+          .then(response => {
+            console.log(response);
+          })
+      }
+    },
+    getFileToken () {
+      network.getData('shop/upload').then(response => {
+        this.uploadToken = response;
+      })
+    },
+    getData (page, pageSize) {
+      let filterData = this.filterModel
+      let vueObj = this
+      network.getPageData(this, 'shop/goods-add', page, pageSize, this.filterModel, response => {
+        this.categoryType = response.categoryType
+        this.goodsType = response.goodsType
+        this.GiftTypeArr = response.giftType
+        this.sellType = response.sellType
+        // this.form.sellType=this.form.sellType.map((item,index)=>{
+        //   return response.sellType.some(val=>(index+1).toString()==val)
+        // })
+      })
+    },
+    addSubmit () {
+      this.submitButtonStat = true
+      let path = 'shop/goods-add';
 
-                // let sellType =[]
-                // this.form.sellType.map((item,index)=>{
-                //   if(item){
-                //     sellType.push((index+1).toString())
-                //   }
-                // });
+      // let sellType =[]
+      // this.form.sellType.map((item,index)=>{
+      //   if(item){
+      //     sellType.push((index+1).toString())
+      //   }
+      // });
 
-                let sen_gift=[];
-                this.form.giftType.map((item,index)=>{
-                    if(item){
-                        sen_gift.push((index+1).toString())
-                    }
-                })
+      let sen_gift = [];
+      this.form.giftType.map((item,index) => {
+        if (item) {
+          sen_gift.push((index+1).toString())
+        }
+      })
 
-                let postData = {
-                    goodsName: this.form.goodsName,
-                    sellDiscount: this.form.sellDiscount,
-                    discount: this.form.type.discount,
-                    type: this.form.type,
-                    giftType: sen_gift,
-                    // sellType: sellType,
-                    sellType: this.form.sellType,
-                    categoryType: this.form.categoryType,
-                    goodsNo: this.form.goodsNo,
-                    unit: this.form.unit,
-                    marketPrice: this.form.marketPrice,
-                    sellPrice: this.form.sellPrice,
-                    sellPriceStandard: this.form.sellPriceStandard,
-                    pricePv: this.form.pricePv,
-                    // point: this.form.point,
-                    storeNums: this.form.storeNums,
-                    content: this.form.content,
-                    sort: this.form.sort,
-                    cover: this.form.cover,
-                    taxRate: this.form.taxRate,
-                }
+      let postData = {
+        goodsName: this.form.goodsName,
+        sellDiscount: this.form.sellDiscount,
+        discount: this.form.type.discount,
+        type: this.form.type,
+        giftType: sen_gift,
+        // sellType: sellType,
+        sellType: this.form.sellType,
+        pvSplit: this.form.pvSplit,
+        categoryType: this.form.categoryType,
+        goodsNo: this.form.goodsNo,
+        unit: this.form.unit,
+        marketPrice: this.form.marketPrice,
+        sellPrice: this.form.sellPrice,
+        sellPriceStandard: this.form.sellPriceStandard,
+        pricePv: this.form.pricePv,
+        // point: this.form.point,
+        storeNums: this.form.storeNums,
+        content: this.form.content,
+        sort: this.form.sort,
+        cover: this.form.cover,
+        taxRate: this.form.taxRate,
+      }
 
-                return network.postData(path, postData).then(response => {
-                    this.$message({
-                        message: response,
-                        type: 'success'
-                    })
-                    this.submitButtonStat = false
-                    this.$router.go(-1)
-                }).catch(() => {
-                    this.submitButtonStat = false
-                })
-            },
-           /*
-            handleEdit() {
-                this.dialogEditFormVisible = false
-                this.$message({
-                    message: '正在修改数据',
-                    type: 'info'
-                })
-                let path = 'finance/deal-type-edit'
-                network.postData(path, this.form).then(response => {
-                    this.$message({
-                        message: response,
-                        type: 'success'
-                    })
-                    this.getData(this.currentPage, this.pageSize)
-                }).catch(response => {
-                })
-            },*/
-        }
-    }
+      return network.postData(path, postData).then(response => {
+        this.$message({
+          message: response,
+          type: 'success'
+        })
+        this.submitButtonStat = false
+        this.$router.go(-1)
+      }).catch(() => {
+        this.submitButtonStat = false
+      })
+    },
+    // handleEdit() {
+    //   this.dialogEditFormVisible = false
+    //   this.$message({
+    //     message: '正在修改数据',
+    //     type: 'info'
+    //   })
+    //   let path = 'finance/deal-type-edit'
+    //   network.postData(path, this.form).then(response => {
+    //     this.$message({
+    //       message: response,
+    //       type: 'success'
+    //     })
+    //     this.getData(this.currentPage, this.pageSize)
+    //   }).catch(response => {
+    //   })
+    // },
+  }
+}
 </script>
 
 <style scoped>

+ 7 - 3
common/models/forms/ShopGoodsForm.php

@@ -22,6 +22,7 @@ class ShopGoodsForm extends Model
     public $sellDiscount;
     public $giftType;
     public $sellType;
+    public $pvSplit;
     public $goodsNo;
     public $unit;
     public $taxRate;
@@ -73,7 +74,8 @@ class ShopGoodsForm extends Model
             'sellDiscount' => 'Discount Rate', // 会员折扣
             'giftType' => 'Product Type', // 商品类型
             'categoryType' => 'Product Category', // 商品分类
-            'sellType' => 'SellType', //出售方式
+            'sellType' => 'SellType', // 出售方式
+            'pvSplit' => 'PV Split', // pv分期
             'goodsNo' => 'Product Code', // 产品编号
             'unit' => 'Unit', // 单位
             'cover' => 'Cover',// 封面
@@ -97,8 +99,8 @@ class ShopGoodsForm extends Model
     {
         $parentScenarios =  parent::scenarios();
         $customScenarios = [
-            'add' => ['goodsName','sellDiscount','giftType', 'sellType','goodsNo','unit','sellPrice','marketPrice','pricePv','storeNums', 'content','sort','cover', 'categoryType', 'sellPriceStandard', 'taxRate', 'taxAmount'],
-            'edit' => ['id','goodsName','sellDiscount','giftType', 'sellType','goodsNo','unit','sellPrice','marketPrice','pricePv', 'storeNums', 'content','sort','cover', 'categoryType', 'sellPriceStandard', 'taxRate'],
+            'add' => ['goodsName','sellDiscount','giftType', 'sellType','goodsNo','unit','sellPrice','marketPrice','pricePv','storeNums', 'content','sort','cover', 'categoryType', 'sellPriceStandard', 'taxRate', 'taxAmount','pvSplit'],
+            'edit' => ['id','goodsName','sellDiscount','giftType', 'sellType','goodsNo','unit','sellPrice','marketPrice','pricePv', 'storeNums', 'content','sort','cover', 'categoryType', 'sellPriceStandard', 'taxRate','pvSplit'],
             'changeStatus' => ['selectedIds', 'status'],
         ];
         return array_merge($parentScenarios, $customScenarios);
@@ -198,6 +200,7 @@ class ShopGoodsForm extends Model
             $shopGoods->GIFT_TYPE = implode(',',$this->giftType);
 //             $shopGoods->SELL_TYPE = implode(',',$this->sellType);
             $shopGoods->SELL_TYPE = $this->sellType;
+            $shopGoods->PV_SPLIT = $this->pvSplit;
             $shopGoods->GOODS_NO = $this->goodsNo;
             $shopGoods->UNIT = $this->unit ? $this->unit : '个';
             $shopGoods->COVER = $this->cover ? $this->cover : '';
@@ -245,6 +248,7 @@ class ShopGoodsForm extends Model
             $model->GIFT_TYPE = implode(',',$this->giftType);
 //            $model->SELL_TYPE = implode(',',$this->sellType);
             $model->SELL_TYPE = $this->sellType;
+            $model->PV_SPLIT = $this->pvSplit;
             $model->GOODS_NO = $this->goodsNo;
             $model->UNIT = $this->unit ? $this->unit : '个';
             $model->COVER = $this->cover ? $this->cover : '';