Procházet zdrojové kódy

商品列表、盲票列表新增排序

DELL před 3 roky
rodič
revize
880536ea3d

+ 8 - 0
src/api/business/goods.js

@@ -42,3 +42,11 @@ export function setGoodsStatus(data) {
     data
   })
 }
+export function setTableData(data) {
+  return request({
+    url: '/api/v1/mp/admin/goods/update/sortWeight',
+    method: 'post',
+    data,
+  })
+}
+

+ 10 - 1
src/api/business/ticket.js

@@ -28,7 +28,7 @@ export function ticketBoxDetail(data) {
   })
 }
 
-// 
+//
 export function urlschemaGeneratee(data) {
   return request({
     url: '/api/v1/mp/wx/urlschema/generate',
@@ -100,3 +100,12 @@ export function ticketBoxRemove(data) {
     data
   })
 }
+
+// 步进器修改
+export function setListData(data) {
+  return request({
+    url: '/api/v1/mp/admin/ticket/box/update/sortWeight',
+    method: 'post',
+    data
+  })
+}

+ 16 - 5
src/views/business/goods/index.vue

@@ -117,9 +117,10 @@
           <el-tag :type="JSON.parse(row.status).value === 'on' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
         </template>
       </el-table-column>
-      <el-table-column label="排序" prop="sort"  sortable="custom" align="center" width="140px">
-<!--        排序优先级-->
-        <el-input-number v-model="sortNum" controls-position="right" :min="0" :max="999" size="small"></el-input-number>
+      <el-table-column label="排序" prop="sortWeight"  sortable="custom" align="center" width="140px">
+        <template slot-scope="{row, $index}">
+            <el-input-number v-model="row.sortWeight" @change="handleSortChange($index,row.sortWeight)" controls-position="right" size="small"></el-input-number>
+        </template>
       </el-table-column>
       <el-table-column fixed="right" align="center" label="操作" width="140">
         <template slot-scope="{row}">
@@ -136,7 +137,7 @@
 </template>
 <script>
 import { publicFileGetUrl } from "@/api/common"
-import { getGoodsList, delGoods, setGoodsStatus } from '@/api/business/goods'
+import { getGoodsList, delGoods, setGoodsStatus, setTableData} from '@/api/business/goods'
 import { goodsCategoryItems } from '@/api/business/category'
 import { goodsTagItems } from '@/api/business/tag'
 import { accMul } from '@/utils/util'
@@ -152,7 +153,6 @@ export default {
       total: 0,
       goodsCategoryItemsList: [],
       goodsTagItemsList: [],
-      sortNum:0,
     }
   },
   created() {
@@ -171,6 +171,16 @@ export default {
       }
     },
 
+    //步进器修改
+    handleSortChange(index,sortWeight){
+      this.tableData[index].sortWeight = sortWeight
+      let data = {
+        goodsId: this.tableData[index].goodsId,
+        sortWeight: this.tableData[index].sortWeight
+      }
+      setTableData(data)
+    },
+
     getGoodsCategoryItems(){
       goodsCategoryItems({}).then(res => {
         this.goodsCategoryItemsList = res && res.data
@@ -204,6 +214,7 @@ export default {
         this.loading = false
         if (res.code === 0) {
           this.tableData = res.rows
+          // this.tableData.map()
           this.total = res.total
         }
       }).catch(() => {

+ 16 - 4
src/views/business/ticket/index.vue

@@ -180,9 +180,10 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="排序" prop="sort"  sortable="custom" align="center" width="140px">
-        <!--        排序优先级-->
-        <el-input-number v-model="sortNum" controls-position="right" :min="0" :max="999" size="small"></el-input-number>
+      <el-table-column label="排序" prop="sortWeight"  sortable="custom" align="center" width="140px">
+        <template slot-scope="{row, $index}">
+          <el-input-number v-model="row.sortWeight" @change="handleSortChange($index,row.sortWeight)" controls-position="right" size="small"></el-input-number>
+        </template>
       </el-table-column>
 
       <el-table-column
@@ -253,7 +254,7 @@ import {
   exportTicket,
   exportDraw,
   ticketBoxPut,
-  ticketBoxRemove,
+  ticketBoxRemove, setListData
 } from "@/api/business/ticket";
 import { publicFileGetUrl } from "@/api/common";
 import TicketImport from "./import";
@@ -308,6 +309,17 @@ export default {
         this.getList()
       }
     },
+
+    //步进器修改
+    handleSortChange(index,sortWeight){
+      this.list[index].sortWeight = sortWeight
+      let data = {
+        boxId: this.list[index].boxId,
+        sortWeight: this.list[index].sortWeight
+      }
+      setListData(data)
+    },
+
     // 盲票组列表
     getList(reset) {
       if (this.loading) {