فهرست منبع

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

DELL 3 سال پیش
والد
کامیت
eb33500751
2فایلهای تغییر یافته به همراه53 افزوده شده و 27 حذف شده
  1. 28 14
      src/views/business/goods/index.vue
  2. 25 13
      src/views/business/ticket/index.vue

+ 28 - 14
src/views/business/goods/index.vue

@@ -78,7 +78,7 @@
       </el-col>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
     </el-row>
-    <el-table v-loading="loading" :data="tableData">
+    <el-table v-loading="loading" :data="tableData"  @sort-change="sortChannelId">
       <el-table-column label="商品ID" prop="goodsId" width="60" />
       <el-table-column label="商品ID" prop="goodsId" width="60" />
       <el-table-column label="商品图片" prop="picUrl" align="center">
       <el-table-column label="商品图片" prop="picUrl" align="center">
         <template slot-scope="{row}">
         <template slot-scope="{row}">
@@ -93,32 +93,35 @@
         </template>
         </template>
       </el-table-column>
       </el-table-column>
       <el-table-column label="商品名称" prop="title" />
       <el-table-column label="商品名称" prop="title" />
-      <el-table-column label="价格" prop="value">
+      <el-table-column label="价格" prop="value" sortable="custom">
         <template slot-scope="{row}">
         <template slot-scope="{row}">
           ¥{{$numberFormat(row.value)}}
           ¥{{$numberFormat(row.value)}}
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="采购价格" prop="cost">
+      <el-table-column label="采购价格" prop="cost" sortable="custom" min-width="100px">
         <template slot-scope="{row}">
         <template slot-scope="{row}">
           ¥{{$numberFormat(row.cost)}}
           ¥{{$numberFormat(row.cost)}}
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="是否支持兑换" prop="exchangeShow">
+      <el-table-column label="是否支持兑换" prop="exchangeShow" min-width="100px">
         <template slot-scope="{row}">
         <template slot-scope="{row}">
           <span v-if="row.exchangeShow == '1'">支持</span>
           <span v-if="row.exchangeShow == '1'">支持</span>
           <span v-if="row.exchangeShow == '0'">不支持</span>
           <span v-if="row.exchangeShow == '0'">不支持</span>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="兑换盲豆数量" prop="exchangePrice" />
-      <el-table-column label="销量" prop="exchangedQty" />
-      <el-table-column label="库存" prop="quantity" />
+      <el-table-column label="兑换盲豆数量" prop="exchangePrice" sortable="custom" min-width="125" />
+      <el-table-column label="销量" prop="exchangedQty" sortable="custom" />
+      <el-table-column label="库存" prop="quantity" sortable="custom" />
       <el-table-column label="状态" prop="status">
       <el-table-column label="状态" prop="status">
         <template slot-scope="{row}">
         <template slot-scope="{row}">
           <el-tag :type="JSON.parse(row.status).value === 'on' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
           <el-tag :type="JSON.parse(row.status).value === 'on' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <!-- <el-table-column label="排序" prop="sort" /> -->
-      <el-table-column fixed="right" align="right" label="操作" width="140">
+      <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>
+      <el-table-column fixed="right" align="center" label="操作" width="140">
         <template slot-scope="{row}">
         <template slot-scope="{row}">
           <!-- <el-button v-hasPermi="['business:goods:query']" type="text">查看</el-button> -->
           <!-- <el-button v-hasPermi="['business:goods:query']" type="text">查看</el-button> -->
           <el-button v-hasPermi="['business:goods:edit']" type="text" @click="$router.push('/goods/edit?id=' + row.goodsId)">编辑</el-button>
           <el-button v-hasPermi="['business:goods:edit']" type="text" @click="$router.push('/goods/edit?id=' + row.goodsId)">编辑</el-button>
@@ -144,11 +147,12 @@ export default {
       IMG_URL: publicFileGetUrl,
       IMG_URL: publicFileGetUrl,
       loading: false,
       loading: false,
       showSearch: true,
       showSearch: true,
-      queryParams: {},
+      queryParams: {pageNum: 1, pageSize: 20, orderByColumn: '', isAsc: '',},
       tableData: [],
       tableData: [],
       total: 0,
       total: 0,
       goodsCategoryItemsList: [],
       goodsCategoryItemsList: [],
       goodsTagItemsList: [],
       goodsTagItemsList: [],
+      sortNum:0,
     }
     }
   },
   },
   created() {
   created() {
@@ -157,6 +161,16 @@ export default {
     this.getGoodsTagItems()
     this.getGoodsTagItems()
   },
   },
   methods: {
   methods: {
+    //切换排序
+    sortChannelId(row){
+      if (row){
+        let prop =  row.prop == 'commRate' ? ('t1.'+ row.prop) : row.prop;
+        this.queryParams.orderByColumn = prop
+        this.queryParams.isAsc = row.order=='ascending'?"asc":"desc";
+        this.getList()
+      }
+    },
+
     getGoodsCategoryItems(){
     getGoodsCategoryItems(){
       goodsCategoryItems({}).then(res => {
       goodsCategoryItems({}).then(res => {
         this.goodsCategoryItemsList = res && res.data
         this.goodsCategoryItemsList = res && res.data
@@ -172,10 +186,10 @@ export default {
         return
         return
       }
       }
       this.loading = true
       this.loading = true
-      if (reset) {
-        this.queryParams = { pageNum: 1, pageSize: 20 }
-      }
-      getGoodsList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', {
+      // if (reset) {
+      //   this.queryParams = { pageNum: 1, pageSize: 20, orderByColumn: '', isAsc: '', }
+      // }
+      getGoodsList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&orderByColumn='+ this.queryParams.orderByColumn +'&isAsc='+ this.queryParams.isAsc +'&', {
         title: this.queryParams.title,
         title: this.queryParams.title,
         goodsId: this.queryParams.goodsId,
         goodsId: this.queryParams.goodsId,
         categoryId: this.queryParams.categoryId,
         categoryId: this.queryParams.categoryId,

+ 25 - 13
src/views/business/ticket/index.vue

@@ -120,7 +120,7 @@
       v-loading="loading"
       v-loading="loading"
       :data="list"
       :data="list"
       @select="handleSelect"
       @select="handleSelect"
-      class="ticket-table"
+      class="ticket-table"  @sort-change="sortChannelId"
     >
     >
       <el-table-column
       <el-table-column
         type="selection"
         type="selection"
@@ -128,7 +128,7 @@
         align="center"
         align="center"
         fixed="left"
         fixed="left"
       />
       />
-      <el-table-column label="盲票组ID" prop="boxId" min-width="80" />
+      <el-table-column label="盲票组ID" prop="boxId" min-width="100" sortable="custom" />
       <el-table-column label="盲票图片" prop="picUrl" min-width="120">
       <el-table-column label="盲票图片" prop="picUrl" min-width="120">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <div>
           <div>
@@ -141,17 +141,17 @@
         </template>
         </template>
       </el-table-column>
       </el-table-column>
       <el-table-column label="盲票组名称" prop="title" min-width="85" />
       <el-table-column label="盲票组名称" prop="title" min-width="85" />
-      <el-table-column label="盲票组面值" prop="facePrice" min-width="85">
+      <el-table-column label="盲票组面值" prop="facePrice" min-width="85" sortable="custom" width="110px">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <div>¥{{ $numberFormat(scope.row.facePrice) }}</div>
           <div>¥{{ $numberFormat(scope.row.facePrice) }}</div>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="盲票总数" prop="quantity" width="90">
+      <el-table-column label="盲票总数" prop="quantity" width="100px" sortable="custom">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <div>{{ scope.row.quantity }}张</div>
           <div>{{ scope.row.quantity }}张</div>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="已售张数" prop="saleQty" min-width="90">
+      <el-table-column label="已售张数" prop="saleQty" min-width="100" sortable="custom">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <div>{{ scope.row.saleQty }}张</div>
           <div>{{ scope.row.saleQty }}张</div>
         </template>
         </template>
@@ -161,12 +161,12 @@
           {{ scope.row.type.desc }}
           {{ scope.row.type.desc }}
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="采购单价" prop="pkgSalePrice" min-width="90">
+      <el-table-column label="采购单价" prop="pkgSalePrice" min-width="100" sortable="custom">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <div>¥{{ $numberFormat(scope.row.pkgSalePrice) }}/包</div>
           <div>¥{{ $numberFormat(scope.row.pkgSalePrice) }}/包</div>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="已采购数量" prop="salePkgQty" min-width="90">
+      <el-table-column label="已采购数量" prop="salePkgQty" min-width="110" sortable="custom">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <div>{{ scope.row.salePkgQty }}包</div>
           <div>{{ scope.row.salePkgQty }}包</div>
         </template>
         </template>
@@ -180,6 +180,11 @@
         </template>
         </template>
       </el-table-column>
       </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>
+
       <el-table-column
       <el-table-column
         label="操作"
         label="操作"
         align="center"
         align="center"
@@ -259,6 +264,7 @@ export default {
   },
   },
   data() {
   data() {
     return {
     return {
+      sortNum:0,
       loading: false,
       loading: false,
       exportLoading: false,
       exportLoading: false,
       showSearch: true,
       showSearch: true,
@@ -270,6 +276,8 @@ export default {
       pageParams: {
       pageParams: {
         pageNum: 1,
         pageNum: 1,
         pageSize: 10,
         pageSize: 10,
+        orderByColumn: '',
+        isAsc: 'desc',
       },
       },
       // 总条数
       // 总条数
       total: 0,
       total: 0,
@@ -291,6 +299,15 @@ export default {
     this.getList();
     this.getList();
   },
   },
   methods: {
   methods: {
+    //切换排序
+    sortChannelId(row){
+      if (row){
+        let prop =  row.prop == 'channelId' || row.prop == 'commRate' ? ('t1.'+ row.prop) : row.prop;
+        this.pageParams.orderByColumn = prop
+        this.pageParams.isAsc = row.order=='ascending'?"asc":"desc";
+        this.getList()
+      }
+    },
     // 盲票组列表
     // 盲票组列表
     getList(reset) {
     getList(reset) {
       if (this.loading) {
       if (this.loading) {
@@ -300,12 +317,7 @@ export default {
       if (reset) {
       if (reset) {
         this.queryParams = { pageNum: 1, pageSize: 20 };
         this.queryParams = { pageNum: 1, pageSize: 20 };
       }
       }
-      getTicketList(
-        "pageNum=" +
-          this.pageParams.pageNum +
-          "&pageSize=" +
-          this.pageParams.pageSize +
-          "&",
+      getTicketList( 'pageNum=' + this.pageParams.pageNum + '&pageSize=' + this.pageParams.pageSize + '&orderByColumn='+ this.pageParams.orderByColumn +'&isAsc='+ this.pageParams.isAsc +'&',
         this.queryParams
         this.queryParams
       )
       )
         .then((res) => {
         .then((res) => {