New file |
| | |
| | | import service from "@/libs/axios"; |
| | | |
| | | // 编辑商品标签 |
| | | export const addOrUpDateTag = (params) => { |
| | | return service({ |
| | | url: "/lmk/goodsTag/addOrUpdate", |
| | | method: "POST", |
| | | data: params |
| | | }) |
| | | } |
| | | |
| | | export const getGoodSTagById = (params) => { |
| | | return service({ |
| | | url: "/lmk/goodsTag/getGoods/" +params, |
| | | method: "GET", |
| | | }) |
| | | } |
| | |
| | | return getRequest(`/statistics/refund/order/getPrice`, params) |
| | | } |
| | | |
| | | export const getGoodsFirstSkuId = (id) =>{ |
| | | return getRequest('/goods/goods/getFirstSkuId/'+id) |
| | | export const getGoodsFirstSkuId = (id) => { |
| | | return getRequest('/goods/goods/getFirstSkuId/' + id) |
| | | } |
| | | |
| | | export const queryExportGoods = (params) =>{ |
| | | return getRequest("/goods/goods/queryExportGoods", params,'blob') |
| | | } |
| | | |
| | |
| | | // 获取优惠券领取记录 |
| | | export const getCouponReceiveList = (params) => { |
| | | return getRequest("/promotion/coupon/received", params); |
| | | }; |
| | | }; |
| | | |
| | | export const queryExportCoupon = (params) =>{ |
| | | return getRequest("/promotion/coupon/queryExportCoupon", params,'blob') |
| | | } |
| | |
| | | icon="ios-search" |
| | | >搜索</Button |
| | | > |
| | | <Button |
| | | @click="queryExportGoods" |
| | | class="search-btn" |
| | | type="primary" |
| | | >导出商品清单</Button |
| | | > |
| | | </Form> |
| | | <Table |
| | | :loading="loading" |
| | |
| | | </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="二维码" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getGoodsListData, upGoods, lowGoods ,getGoodsFirstSkuId } from "@/api/goods"; |
| | | import { getGoodsListData, upGoods, lowGoods ,getGoodsFirstSkuId,queryExportGoods } 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, |
| | |
| | | name: "goods", |
| | | data() { |
| | | return { |
| | | tagForm:{ |
| | | selectTagIds:[], |
| | | goodsId:'', |
| | | createType:'MANAGER', |
| | | }, |
| | | |
| | | selectLoading: false, |
| | | options: [], |
| | | |
| | | showUpdateTag:false, |
| | | |
| | | |
| | | showGeneralQrCode:false, |
| | | QRCodeUrl:'', |
| | | codeUrl: this.QRcodeBaseUrl+ '/scanpage/goods', |
| | |
| | | "Button", |
| | | { |
| | | props: { |
| | | type: "info", |
| | | size: "small", |
| | | }, |
| | | on: { |
| | |
| | | }, |
| | | }, |
| | | "生成二维码" |
| | | ), |
| | | h( |
| | | "Button", |
| | | { |
| | | style: { |
| | | marginRight: "5px", |
| | | marginTop: "5px", |
| | | }, |
| | | props: { |
| | | size: "small", |
| | | }, |
| | | on: { |
| | | click: () => { |
| | | this.openTagsModal(params.row); |
| | | }, |
| | | }, |
| | | }, |
| | | "编辑标签" |
| | | ) |
| | | ]); |
| | | } else { |
| | |
| | | h( |
| | | "Button", |
| | | { |
| | | style: { |
| | | marginRight: "5px", |
| | | }, |
| | | props: { |
| | | type: "error", |
| | | size: "small", |
| | |
| | | }, |
| | | }, |
| | | "生成二维码" |
| | | ),h( |
| | | "Button", |
| | | { |
| | | style: { |
| | | marginRight: "5px", |
| | | marginTop: "5px", |
| | | }, |
| | | props: { |
| | | size: "small", |
| | | }, |
| | | on: { |
| | | click: () => { |
| | | this.openTagsModal(params.row); |
| | | }, |
| | | }, |
| | | }, |
| | | "编辑标签" |
| | | ) |
| | | ]); |
| | | } |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | 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但是依然不支持download |
| | | 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; |
| | | }, |
| | |
| | | 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> |
| | |
| | | class="search-btn" |
| | | >搜索</Button |
| | | > |
| | | <Button |
| | | @click="queryExportCoupon" |
| | | type="primary" |
| | | class="search-btn"> |
| | | 导出领取记录 |
| | | </Button> |
| | | </Form> |
| | | <Table |
| | | v-if="refreshTable" |
| | |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { getCouponReceiveList } from "@/api/promotion"; |
| | | import { getCouponReceiveList,queryExportCoupon } from "@/api/promotion"; |
| | | import { |
| | | memberPromotionsStatusRender, |
| | | promotionsScopeTypeRender, |
| | |
| | | }, |
| | | }, |
| | | methods: { |
| | | queryExportCoupon(){ |
| | | console.log(this.selectDate.length === 0); |
| | | |
| | | if(this.selectDate.length === 0){ |
| | | this.$Message.error("必须选择时间范围,搜索后进行导出!"); |
| | | this.searchForm.startTime = null; |
| | | this.searchForm.endTime = null; |
| | | }else{ |
| | | this.searchForm.startTime = this.selectDate[0].getTime(); |
| | | this.searchForm.endTime = this.selectDate[1].getTime(); |
| | | queryExportCoupon(this.searchForm).then(res =>{ |
| | | const blob = new Blob([res], { |
| | | type: "application/vnd.ms-excel;charset=utf-8", |
| | | }); |
| | | //对于<a>标签,只有 Firefox 和 Chrome(内核) 支持 download 属性 |
| | | //IE10以上支持blob但是依然不支持download |
| | | 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); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | back() { |
| | | this.$store.commit("removeTag", "coupon-receive"); |
| | | this.$router.go(-1); |