Jelajahi Sumber

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
修改

1004749546@qq.com 4 tahun lalu
induk
melakukan
c772371811
2 mengubah file dengan 108 tambahan dan 86 penghapusan
  1. 86 80
      src/views/shop/GoodsChooseModal.vue
  2. 22 6
      src/views/shop/goodsShelves.vue

+ 86 - 80
src/views/shop/GoodsChooseModal.vue

@@ -10,7 +10,7 @@
     <a-form :form="form" ref="form" @submit="handleSubmit">
       <a-row class="search-cont">
         <a-col span="8">
-          <a-input id="goodsChooseModal-name" allowClear v-model.trim="queryParam.name" placeholder="商品名称"/>
+          <a-input id="goodsChooseModal-name" allowClear v-model.trim="queryParam.name" placeholder="商品名称" />
         </a-col>
         <a-col style="margin-left: 20px;" span="3">
           <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
@@ -26,8 +26,7 @@
         :columns="columns"
         :scroll="{y:500}"
         :data="loadData"
-        :bordered="false"
-      >
+        :bordered="false">
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record, index">
           <a id="goodsChooseModal-choose" @click="handleSubmit">选择</a>
@@ -39,7 +38,9 @@
 </template>
 
 <script>
-import { STable } from '@/components'
+import {
+  STable
+} from '@/components'
 export default {
   name: 'SetPriceModal',
   components: {
@@ -50,6 +51,11 @@ export default {
       type: Boolean,
       default: false
     },
+    // 已选商品
+    chooseData: {
+      type: Array,
+      default: []
+    },
     // 设置项id
     itemId: {
       type: [String, Number],
@@ -68,8 +74,7 @@ export default {
     isshow (newValue, oldValue) {
       if (newValue) {
         if (this.itemId) {
-          this.dataSource = []
-          this.getDetail(this.itemId)
+		  this.$refs.table.refresh(true)
         }
       } else {
         this.cancel()
@@ -82,82 +87,83 @@ export default {
       form: this.$form.createForm(this, {
         name: 'GoodsChooseModal'
       }),
-	  // 查询参数
+      // 查询参数
       queryParam: {
         name: ''
-	  },
+      },
       // 表头
-      columns: [
-        {
-          title: '序号',
-          dataIndex: 'no',
-          width: 60,
-          align: 'center'
-        },
-        {
-          title: '商品名称',
-          width: 200,
-          align: 'center',
-          customRender: (record) => {
-            return record.bundleItem.itemClsName
-          }
-        },
-        {
-          title: '商品价格(乐豆)',
-          width: 150,
-          align: 'center',
-          customRender: (record) => {
-            return record.bundleItem.itemName
-          }
-        },
-        {
-          title: '供货商',
-          width: 200,
-          align: 'center',
-          customRender: (record) => {
-            return record.bundleItem.itemPrice
-          }
-        },
-        {
-          title: '库存数量',
-          width: 100,
-          align: 'center',
-          customRender: (record) => {
-            return record.bundleItem.times
-          }
-        },
-        {
-		  title: '已售数量',
-		  dataIndex: 'times',
-		  width: 100,
-		  align: 'center'
-        },
-        {
-          title: '操作',
-          width: 150,
-          align: 'center',
-          scopedSlots: { customRender: 'action' }
+      columns: [{
+        title: '序号',
+        dataIndex: 'no',
+        width: 60,
+        align: 'center'
+      },
+      {
+        title: '商品名称',
+        width: 200,
+        align: 'center',
+        customRender: (record) => {
+          return record.bundleItem.itemClsName
+        }
+      },
+      {
+        title: '商品价格(乐豆)',
+        width: 150,
+        align: 'center',
+        customRender: (record) => {
+          return record.bundleItem.itemName
+        }
+      },
+      {
+        title: '供货商',
+        width: 200,
+        align: 'center',
+        customRender: (record) => {
+          return record.bundleItem.itemPrice
+        }
+      },
+      {
+        title: '库存数量',
+        width: 100,
+        align: 'center',
+        customRender: (record) => {
+          return record.bundleItem.times
         }
+      },
+      {
+        title: '已售数量',
+        dataIndex: 'times',
+        width: 100,
+        align: 'center'
+      },
+      {
+        title: '操作',
+        width: 150,
+        align: 'center',
+        scopedSlots: {
+          customRender: 'action'
+        }
+      }
       ],
-	  // 加载数据方法 必须为 Promise 对象
-	  loadData: parameter => {
-	    // const _this = this
-	    // return getPartnerList(Object.assign(parameter, this.queryParam)).then(res => {
-	    //   if (res.status == 200) {
-	    //     const data = res.data
-	    //     const no = (data.pageNo - 1) * data.pageSize
-	    //     for (var i = 0; i < data.list.length; i++) {
-	    //       data.list[i].no = no + i + 1
-	    //       data.list[i].status = data.list[i].status == 1
-	    //     }
-	    //     // console.log(data)
-	    //     return data
-	    //   } else {
-	    //     _this.$message.error('获取数据出错')
-	    //     return []
-	    //   }
-	    // })
-	  }
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        // const _this = this
+        // return getPartnerList(Object.assign(parameter, this.queryParam)).then(res => {
+        //   if (res.status == 200) {
+        //     const data = res.data
+        //     const no = (data.pageNo - 1) * data.pageSize
+        //     for (var i = 0; i < data.list.length; i++) {
+        //       data.list[i].no = no + i + 1
+        //       data.list[i].status = data.list[i].status == 1
+        //     }
+        //     // console.log(data)
+        //     return data
+        //   } else {
+        //     _this.$message.error('获取数据出错')
+        //     return []
+        //   }
+        // })
+      }
     }
   },
   methods: {
@@ -198,7 +204,7 @@ export default {
 </script>
 
 <style scoped="true">
-  .search-cont{
-	  margin-bottom: 20px;
-  }
+	.search-cont {
+		margin-bottom: 20px;
+	}
 </style>

+ 22 - 6
src/views/shop/goodsShelves.vue

@@ -28,7 +28,7 @@
       </a-col>
     </a-row>
     <!-- 选择商品 弹框 -->
-    <goods-choose-modal :itemId="itemId" :visible="isShowModal" @refresh="" @close="isShowModal=false"></goods-choose-modal>
+    <goods-choose-modal :itemId="itemId" :chooseData="loadData" :visible="isShowModal" @refresh="" @close="isShowModal=false"></goods-choose-modal>
   </a-card>
 
 </template>
@@ -78,19 +78,19 @@ export default {
       },
       {
         title: '商品名称',
-        dataIndex: 'createDate',
+        dataIndex: 'name',
         width: 200,
         align: 'center'
       },
       {
         title: '商品价格(乐豆)',
         width: 200,
-        dataIndex: 'name',
+        dataIndex: 'price',
         align: 'center'
       },
       {
         title: '库存数量',
-        dataIndex: 'contactName',
+        dataIndex: 'num',
         width: 120,
         align: 'center',
         customRender: (text) => {
@@ -106,12 +106,18 @@ export default {
         }
       }
       ],
-	  loadData: []
+	  loadData: [
+		  { no: 1, name: '苹果', price: 10, num: 10 },
+		  { no: 2, name: '苹果', price: 10, num: 10 },
+		  { no: 3, name: '苹果', price: 10, num: 10 },
+		  { no: 4, name: '苹果', price: 10, num: 10 },
+		  { no: 5, name: '苹果', price: 10, num: 10 }
+	  ]
     }
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
-      vm.reset()
+      vm.getData()
     })
   },
   methods: {
@@ -119,6 +125,16 @@ export default {
     handleClick (item) {
       console.log(item, 'kkkkkkkkkk')
     },
+    // 查询数据
+    getData () {
+      getTenantsList({ pageNo: 1, pageSize: 10 }).then(res => {
+        if (res.status == 200) {
+          this.loadData = res.data.list
+        } else {
+          this.loadData = []
+        }
+      })
+    },
     // 打开新增/编辑 弹窗
     openModal (row) {
       this.itemId = row ? row.id : ''