From 5f74a0711c0151a51493e596a614ad2f5ddbed6c Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 23 十月 2025 18:04:30 +0800
Subject: [PATCH] 分页问题
---
manager/src/views/goods/goods-info/goods.vue | 303 +++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 282 insertions(+), 21 deletions(-)
diff --git a/manager/src/views/goods/goods-info/goods.vue b/manager/src/views/goods/goods-info/goods.vue
index 7dd86dd..bf50b4b 100644
--- a/manager/src/views/goods/goods-info/goods.vue
+++ b/manager/src/views/goods/goods-info/goods.vue
@@ -76,6 +76,12 @@
icon="ios-search"
>鎼滅储</Button
>
+ <Button
+ @click="queryExportGoods"
+ class="search-btn"
+ type="primary"
+ >瀵煎嚭鍟嗗搧娓呭崟</Button
+ >
</Form>
<Table
:loading="loading"
@@ -100,30 +106,47 @@
<div style="margin-left: 13px">
<div class="div-zoom">
- <a @click="linkTo(row.id, row.skuId)">{{ row.goodsName }}</a>
+ {{ row.goodsName }}
</div>
- <Poptip trigger="hover" title="鎵爜鍦ㄦ墜鏈轰腑鏌ョ湅" transfer>
- <div slot="content">
- <vue-qr
- :text="wapLinkTo(row.id, row.skuId)"
- :margin="0"
- colorDark="#000"
- colorLight="#fff"
- :size="150"
- ></vue-qr>
- </div>
- <img
- src="../../../assets/qrcode.svg"
- class="hover-pointer"
- width="20"
- height="20"
- alt=""
- />
- </Poptip>
</div>
</div>
</template>
</Table>
+ <Modal
+ v-model="showUpdateTag"
+ title="鏍囩"
+ width="800"
+ :mask-closable="false"
+ >
+ <Select v-model="tagForm.selectTagIds" multiple filterable :loading="selectLoading" style="width:200px;">
+ <Option v-for="item in options" :key="item.id" :label="item.tagName" :value="item.id"></Option>
+ </Select>
+
+ <div slot="footer">
+ <Button type="error" @click="saveTag">淇濆瓨</Button>
+ <!-- <Button type="primary" @click="generalQrCode">纭</Button>-->
+ </div>
+ </Modal>
+
+ <Modal
+ v-model="showGeneralQrCode"
+ title="浜岀淮鐮�"
+ width="800"
+ :mask-closable="false"
+ :loading="codeLoading"
+ >
+ <vue-qr
+ :text="QRCodeUrl"
+ :margin="0"
+ colorDark="#000"
+ colorLight="#fff"
+ :size="150"
+ ></vue-qr>
+ <div slot="footer">
+ <Button type="text" @click="closeGeneralQrCode">鍏抽棴</Button>
+ <!-- <Button type="primary" @click="generalQrCode">纭</Button>-->
+ </div>
+ </Modal>
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
@@ -157,13 +180,35 @@
>
</div>
</Modal>
+ <Modal
+ title="璁剧疆鍟嗗搧鎺掑簭"
+ v-model="showSort"
+ :mask-closable="false"
+ :width="500"
+ >
+ <Form ref="underForm" :model="sortForm" :label-width="100">
+ <FormItem label="鍟嗗搧鎺掑簭" prop="reason">
+ <InputNumber v-model="sortForm.sort" :min="0" :max="999" clearable style="width: 100%" />
+ </FormItem>
+ </Form>
+ <div slot="footer">
+ <Button type="text" @click="showSort= false">鍙栨秷</Button>
+ <Button type="primary" :loading="submitLoading" @click="submitSort"
+ >鎻愪氦</Button
+ >
+ </div>
+ </Modal>
</div>
</template>
<script>
-import { getGoodsListData, upGoods, lowGoods } from "@/api/goods";
+import { getGoodsListData, upGoods, lowGoods ,getGoodsFirstSkuId,queryExportGoods,goodsSort } from "@/api/goods";
+
import {getSts} from '@/api/file'
import vueQr from "vue-qr";
+import {getTags} from "@/api/tag";
+import {addOrUpDateTag,getGoodSTagById} from "@/api/goods-tag"
+
export default {
components: {
"vue-qr": vueQr,
@@ -171,6 +216,29 @@
name: "goods",
data() {
return {
+ sortForm:{
+ goodsId:'',
+ sort:0
+ },
+ showSort:false,
+
+ tagForm:{
+ selectTagIds:[],
+ goodsId:'',
+ createType:'MANAGER',
+ },
+
+ selectLoading: false,
+ options: [],
+
+ showUpdateTag:false,
+
+
+ showGeneralQrCode:false,
+ QRCodeUrl:'',
+ codeUrl: this.QRcodeBaseUrl+ '/scanpage/goods',
+ codeLoading:false,
+
id: "", //瑕佹搷浣滅殑id
loading: true, // 琛ㄥ崟鍔犺浇鐘舵��
modalVisible: false, // 娣诲姞鎴栫紪杈戞樉绀�
@@ -274,7 +342,7 @@
key: "action",
align: "center",
fixed: "right",
- width: 150,
+ width: 400,
render: (h, params) => {
if (params.row.marketEnable == "DOWN") {
return h("div", [
@@ -299,6 +367,9 @@
h(
"Button",
{
+ style: {
+ marginRight: "5px",
+ },
props: {
size: "small",
},
@@ -310,6 +381,42 @@
},
"鏌ョ湅"
),
+ h(
+ "Button",
+ {
+ style: {
+ marginRight: "5px",
+ },
+ props: {
+ type: "info",
+ size: "small",
+ },
+ on: {
+ click: () => {
+ this.generalQrCode(params.row);
+ },
+ },
+ },
+ "鐢熸垚浜岀淮鐮�"
+ ),
+ h(
+ "Button",
+ {
+ style: {
+ marginLeft: "5px",
+ marginTop: "5px",
+ },
+ props: {
+ size: "small",
+ },
+ on: {
+ click: () => {
+ this.openTagsModal(params.row);
+ },
+ },
+ },
+ "缂栬緫鏍囩"
+ )
]);
} else {
return h("div", [
@@ -334,6 +441,9 @@
h(
"Button",
{
+ style: {
+ marginRight: "5px",
+ },
props: {
size: "small",
},
@@ -345,6 +455,55 @@
},
"鏌ョ湅"
),
+ h(
+ "Button",
+ {
+ style: {
+ marginRight: "5px",
+ },
+ props: {
+ type: "error",
+ size: "small",
+ },
+ on: {
+ click: () => {
+ this.generalQrCode(params.row);
+ },
+ },
+ },
+ "鐢熸垚浜岀淮鐮�"
+ ), h(
+ "Button",
+ {
+ props: {
+ type: "error",
+ size: "small",
+ },
+ on: {
+ click: () => {
+ this.goodsSort(params.row);
+ },
+ },
+ },
+ "璁剧疆鍟嗗搧鎺掑簭"
+ ),h(
+ "Button",
+ {
+ style: {
+ marginLeft: "5px",
+ marginTop: "5px",
+ },
+ props: {
+ size: "small",
+ },
+ on: {
+ click: () => {
+ this.openTagsModal(params.row);
+ },
+ },
+ },
+ "缂栬緫鏍囩"
+ )
]);
}
},
@@ -355,6 +514,93 @@
};
},
methods: {
+ cancelSort(){
+ console.log('鐐瑰嚮浜嗗彇娑�')
+ this.showSort = false;
+ },
+ async submitSort(){
+ const response = await goodsSort(this.sortForm)
+ console.log(response)
+ this.showSort = false;
+ this.getDataList();
+ },
+ goodsSort(row){
+ // this.sortForm = {
+ //
+ // }
+ this.sortForm.goodsId = row.id;
+ this.sortForm.sort = row.goodsSort
+ this.showSort = true;
+ },
+ saveTag(){
+ this.showUpdateTag = false;
+ const form = {
+ tagIds:this.tagForm.selectTagIds,
+ createType:this.tagForm.createType,
+ goodsId:this.tagForm.goodsId
+ }
+ addOrUpDateTag(form).then(res =>{
+ console.log(res)
+ })
+ },
+ openTagsModal(row){
+
+ this.showUpdateTag = true;
+ this.tagForm.selectTagIds = [];
+ this.tagForm.goodsId = "";
+ getGoodSTagById(row.id).then(res =>{
+ if(res.code === 200){
+ this.tagForm.goodsId = row.id;
+ res.data.forEach(item =>{
+ this.tagForm.selectTagIds.push(item.tagId);
+ })
+ }
+ console.log(this.tagForm)
+ })
+ },
+ queryExportGoods(){
+ queryExportGoods(this.searchForm).then(res =>{
+ const blob = new Blob([res], {
+ type: "application/vnd.ms-excel;charset=utf-8",
+ });
+ //瀵逛簬<a>鏍囩锛屽彧鏈� Firefox 鍜� Chrome锛堝唴鏍革級 鏀寔 download 灞炴��
+ //IE10浠ヤ笂鏀寔blob浣嗘槸渚濈劧涓嶆敮鎸乨ownload
+ if ("download" in document.createElement("a")) {
+ //鏀寔a鏍囩download鐨勬祻瑙堝櫒
+ const link = document.createElement("a"); //鍒涘缓a鏍囩
+ link.download = "鍟嗗搧娓呭崟.xlsx"; //a鏍囩娣诲姞灞炴��
+ link.style.display = "none";
+ link.href = URL.createObjectURL(blob);
+ document.body.appendChild(link);
+ link.click(); //鎵ц涓嬭浇
+ URL.revokeObjectURL(link.href); //閲婃斁url
+ document.body.removeChild(link); //閲婃斁鏍囩
+ } else {
+ navigator.msSaveBlob(blob, fileName);
+ }
+ })
+
+
+ },
+ closeGeneralQrCode(){
+ this.showGeneralQrCode = false;
+ },
+ generalQrCode(row){
+ this.QRCodeUrl = '';
+ this.showGeneralQrCode = true
+ this.codeLoading = true;
+
+ //鑾峰緱鍟嗗搧瀵瑰簲鐨勭涓�涓猻kuid
+ getGoodsFirstSkuId(row.id).then(res =>{
+ this.codeLoading = false;
+
+ if (res.code){
+ this.QRCodeUrl = this.codeUrl + "?id="+ res.result +"&goodsId=" + row.id
+ }
+ })
+
+ },
+
// 鍒濆鍖栨暟鎹�
init() {
this.getDataList();
@@ -445,9 +691,24 @@
query: { id: id },
})
},
+ remoteMethod(query) {
+ this.selectLoading = true;
+ var params = {
+ "tagTypeKey": "GOODS",
+ "pageNumber": 1,
+ "pageSize": 500
+ }
+ getTags(params).then(res => {
+ this.options = res.data;
+ this.selectLoading = false;
+ });
+ },
+
},
+
mounted() {
this.init();
+ this.remoteMethod("")
},
};
</script>
--
Gitblit v1.8.0