Quellcode durchsuchen

Merge branch 'dev' into 'test'

Dev

See merge request quanshu/mp-ui-pc!185
hunagwb vor 3 Jahren
Ursprung
Commit
0ceb17650c

+ 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
+  })
+}

+ 22 - 5
src/views/business/goods/add.vue

@@ -11,7 +11,6 @@
         <el-col :span="23">
           <el-form-item label="商品主图:" prop="picUrl">
             <Upload v-model="mainPicUrl" :limit="10" />
-            <br>
             <div class="tip">第一张图片将作为商品列表图片,最多上传10张,多张图片之间可随意调整位置,支持jpg、png格式,推荐750*750px;</div>
           </el-form-item>
         </el-col>
@@ -30,7 +29,7 @@
       </el-row>
       <el-row :gutter="40" style="width: 500px">
         <el-col :span="23">
-          <el-form-item label="商品分类" prop="categoryId">
+          <el-form-item label="商品分类:" prop="categoryId">
             <el-select
               v-model="addData.categoryId"
               placeholder="请选择商品分类"
@@ -43,7 +42,7 @@
       </el-row>
        <el-row :gutter="40" style="width: 500px">
         <el-col :span="23">
-          <el-form-item label="商品标签">
+          <el-form-item label="商品标签:">
             <el-select
               v-model="addData.tagIds"
               placeholder="请选择商品标签"
@@ -54,6 +53,12 @@
             </el-select>
           </el-form-item>
         </el-col>
+         <el-col :span="23">
+           <el-form-item label="商家信息:">
+             <Upload v-model="MerchantInformation" :limit="10" />
+             <div class="tip">上传商家营业执照</div>
+           </el-form-item>
+         </el-col>
       </el-row>
       <el-divider content-position="left">价格库存</el-divider>
       <el-row>
@@ -188,6 +193,18 @@ export default {
       set(val) {
         this.$set(this.addData, 'picUrl', val.map(item => { return item.fileName }).toString())
       }
+    },
+    MerchantInformation:{
+      get() {
+        return this.addData.merchantInfo ? this.addData.merchantInfo.split(',').map(item => {
+          return {
+            fileName: item
+          }
+        }) : []
+      },
+      set(val) {
+        this.$set(this.addData, 'merchantInfo', val.map(item => { return item.fileName }).toString())
+      }
     }
   },
   created() {
@@ -195,11 +212,11 @@ export default {
     this.getGoodsTagItems()
     if (this.id) {
       getGoodsDetail(this.id).then(res => {
-        const { goodsId, title, picUrl, exchangeShow, multiSku, value, exchangePrice, cost, quantity, description, skuList, categoryId, tagIds } = res.data
+        const { goodsId, title, picUrl,merchantInfo, exchangeShow, multiSku, value, exchangePrice, cost, quantity, description, skuList, categoryId, tagIds } = res.data
         this.addData = {
           value: accDiv(value, 100),
           cost: cost == '' || cost == null ? '' : accDiv(cost, 100),
-          goodsId, title, picUrl, exchangeShow, multiSku, exchangePrice, quantity, description, skuList, categoryId, tagIds
+          goodsId, title, picUrl,merchantInfo, exchangeShow, multiSku, exchangePrice, quantity, description, skuList, categoryId, tagIds
         }
         if(description) {
           this.$refs.editor.setContent(description)

+ 40 - 15
src/views/business/goods/index.vue

@@ -78,7 +78,7 @@
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </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="商品图片" prop="picUrl" align="center">
         <template slot-scope="{row}">
@@ -93,32 +93,36 @@
         </template>
       </el-table-column>
       <el-table-column label="商品名称" prop="title" />
-      <el-table-column label="价格" prop="value">
+      <el-table-column label="价格" prop="value" sortable="custom">
         <template slot-scope="{row}">
           ¥{{$numberFormat(row.value)}}
         </template>
       </el-table-column>
-      <el-table-column label="采购价格" prop="cost">
+      <el-table-column label="采购价格" prop="cost" sortable="custom" min-width="100px">
         <template slot-scope="{row}">
           ¥{{$numberFormat(row.cost)}}
         </template>
       </el-table-column>
-      <el-table-column label="是否支持兑换" prop="exchangeShow">
+      <el-table-column label="是否支持兑换" prop="exchangeShow" min-width="100px">
         <template slot-scope="{row}">
           <span v-if="row.exchangeShow == '1'">支持</span>
           <span v-if="row.exchangeShow == '0'">不支持</span>
         </template>
       </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">
         <template slot-scope="{row}">
           <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" /> -->
-      <el-table-column fixed="right" align="right" label="操作" width="140">
+      <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}">
           <!-- <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>
@@ -133,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'
@@ -144,7 +148,7 @@ export default {
       IMG_URL: publicFileGetUrl,
       loading: false,
       showSearch: true,
-      queryParams: {},
+      queryParams: {pageNum: 1, pageSize: 20, orderByColumn: '', isAsc: '',},
       tableData: [],
       total: 0,
       goodsCategoryItemsList: [],
@@ -157,6 +161,26 @@ export default {
     this.getGoodsTagItems()
   },
   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()
+      }
+    },
+
+    //步进器修改
+    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
@@ -172,10 +196,10 @@ export default {
         return
       }
       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,
         goodsId: this.queryParams.goodsId,
         categoryId: this.queryParams.categoryId,
@@ -190,6 +214,7 @@ export default {
         this.loading = false
         if (res.code === 0) {
           this.tableData = res.rows
+          // this.tableData.map()
           this.total = res.total
         }
       }).catch(() => {

+ 38 - 14
src/views/business/ticket/index.vue

@@ -120,7 +120,7 @@
       v-loading="loading"
       :data="list"
       @select="handleSelect"
-      class="ticket-table"
+      class="ticket-table"  @sort-change="sortChannelId"
     >
       <el-table-column
         type="selection"
@@ -128,7 +128,7 @@
         align="center"
         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">
         <template slot-scope="scope">
           <div>
@@ -141,17 +141,17 @@
         </template>
       </el-table-column>
       <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">
           <div>¥{{ $numberFormat(scope.row.facePrice) }}</div>
         </template>
       </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">
           <div>{{ scope.row.quantity }}张</div>
         </template>
       </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">
           <div>{{ scope.row.saleQty }}张</div>
         </template>
@@ -161,12 +161,12 @@
           {{ scope.row.type.desc }}
         </template>
       </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">
           <div>¥{{ $numberFormat(scope.row.pkgSalePrice) }}/包</div>
         </template>
       </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">
           <div>{{ scope.row.salePkgQty }}包</div>
         </template>
@@ -180,6 +180,12 @@
         </template>
       </el-table-column>
 
+      <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
         label="操作"
         align="center"
@@ -248,7 +254,7 @@ import {
   exportTicket,
   exportDraw,
   ticketBoxPut,
-  ticketBoxRemove,
+  ticketBoxRemove, setListData
 } from "@/api/business/ticket";
 import { publicFileGetUrl } from "@/api/common";
 import TicketImport from "./import";
@@ -259,6 +265,7 @@ export default {
   },
   data() {
     return {
+      sortNum:0,
       loading: false,
       exportLoading: false,
       showSearch: true,
@@ -270,6 +277,8 @@ export default {
       pageParams: {
         pageNum: 1,
         pageSize: 10,
+        orderByColumn: '',
+        isAsc: 'desc',
       },
       // 总条数
       total: 0,
@@ -291,6 +300,26 @@ export default {
     this.getList();
   },
   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()
+      }
+    },
+
+    //步进器修改
+    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) {
@@ -300,12 +329,7 @@ export default {
       if (reset) {
         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
       )
         .then((res) => {