优化促销相关代码

master
paulGao 2021-12-21 18:59:45 +08:00
parent 246ba9057f
commit ab2bcb515f
11 changed files with 462 additions and 489 deletions

View File

@ -164,7 +164,7 @@
</div>
<div
class="add-buy-car"
v-if="$route.query.way === 'POINT' && skuDetail.isAuth === 'PASS'"
v-if="$route.query.way === 'POINT' && skuDetail.authFlag === 'PASS'"
>
<Button
type="error"
@ -176,7 +176,7 @@
</div>
<div
class="add-buy-car"
v-if="$route.query.way !== 'POINT' && skuDetail.isAuth === 'PASS'"
v-if="$route.query.way !== 'POINT' && skuDetail.authFlag === 'PASS'"
>
<Button
type="error"
@ -393,15 +393,6 @@ export default {
for (let i = 0; i < keysArr.length; i++) {
let key = keysArr[i].split("-")[0];
if (
(new Date(this.detail.promotionMap[keysArr[i]].startTime).getTime >
new Date().getTime() &&
new Date(this.detail.promotionMap[keysArr[i]].endTime).getTime <
new Date().getTime()) ||
this.detail.promotionMap[keysArr[i]].getType !== "FREE"
) {
continue;
}
if (key === "COUPON") {
this.promotionMap[key].push(this.detail.promotionMap[keysArr[i]]);
} else {

View File

@ -4,9 +4,7 @@
<!-- LOGO 步骤条 -->
<div class="width_1200 logo">
<div>
<router-link to="/"
><img :src="$store.state.logoImg"
/></router-link>
<router-link to="/"><img :src="$store.state.logoImg" /></router-link>
<div>结算页</div>
</div>
<div class="cart-steps">
@ -23,7 +21,7 @@
<span :class="stepIndex == 2 ? 'active' : ''">3.成功提交订单</span>
</div>
</div>
<Divider/>
<Divider />
<div class="content width_1200">
<!-- 收货地址 -->
<div class="address">
@ -45,31 +43,23 @@
<div>
<span>{{ item.name }}</span>
<Tag class="ml_10" v-if="item.isDefault" color="red"></Tag>
<Tag class="ml_10" v-if="item.alias" color="warning">{{
item.alias
}}
</Tag>
<Tag class="ml_10" v-if="item.alias" color="warning">{{ item.alias }} </Tag>
</div>
<div>{{ item.mobile }}</div>
<div>
{{ item.consigneeAddressPath | unitAddress }} {{ item.detail }}
</div>
<div>{{ item.consigneeAddressPath | unitAddress }} {{ item.detail }}</div>
<div class="edit-btn" v-show="showEditBtn === index">
<span @click.stop="editAddress(item.id)">修改</span>
<span
class="ml_10"
v-if="!item.isDefault"
@click.stop="delAddress(item)"
>删除</span
<span class="ml_10" v-if="!item.isDefault" @click.stop="delAddress(item)"
>删除</span
>
</div>
<div class="corner-icon" v-show="selectedAddress.id === item.id">
<div></div>
<Icon type="md-checkmark"/>
<Icon type="md-checkmark" />
</div>
</div>
<div class="add-address" @click="editAddress('')">
<Icon type="ios-add-circle-outline"/>
<Icon type="ios-add-circle-outline" />
<div>添加新地址</div>
</div>
</div>
@ -80,8 +70,8 @@
v-if="addressList.length > 3"
>
{{ moreAddr ? "收起地址" : "更多地址" }}
<Icon v-show="!moreAddr" type="md-arrow-dropdown"/>
<Icon v-show="moreAddr" type="md-arrow-dropup"/>
<Icon v-show="!moreAddr" type="md-arrow-dropdown" />
<Icon v-show="moreAddr" type="md-arrow-dropup" />
</div>
</div>
<!-- 商品信息 -->
@ -90,16 +80,12 @@
<span>商品信息</span>
<span @click="$router.push('/cart')"></span>
</div>
<div
class="goods-msg"
v-for="(shop, shopIndex) in goodsList"
:key="shopIndex"
>
<div class="goods-msg" v-for="(shop, shopIndex) in goodsList" :key="shopIndex">
<div class="shop-name">
<span>
<span class="hover-color" @click="goShopPage(shop.storeId)">{{
shop.storeName
}}</span
shop.storeName
}}</span
>&nbsp;&nbsp;
</span>
</div>
@ -111,23 +97,15 @@
>
<span
class="hover-color"
@click="
goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)
"
@click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)"
>
<img :src="goods.goodsSku.thumbnail" alt=""/>
<span style="vertical-align: top">{{
goods.goodsSku.goodsName
}}</span>
<img :src="goods.goodsSku.thumbnail" alt="" />
<span style="vertical-align: top">{{ goods.goodsSku.goodsName }}</span>
</span>
<span class="goods-price">{{
goods.purchasePrice | unitPrice("¥")
}}</span>
<span class="goods-price">{{ goods.purchasePrice | unitPrice("¥") }}</span>
<span>x{{ goods.num }}</span>
<span>{{ goods.goodsSku.quantity > 0 ? "有货" : "无货" }}</span>
<span class="goods-price">{{
goods.subTotal | unitPrice("¥")
}}</span>
<span class="goods-price">{{ goods.subTotal | unitPrice("¥") }}</span>
</div>
</div>
<div class="order-mark">
@ -139,7 +117,7 @@
placeholder="订单备注"
/>
<span style="font-size: 12px; color: #999"
>提示请勿填写有关支付收货发票方面的信息</span
>提示请勿填写有关支付收货发票方面的信息</span
>
</div>
</div>
@ -148,7 +126,7 @@
<div class="invoice">
<div class="card-head mt_20 mb_20">
<span class="relative"
>发票信息<span class="inv-tips">
>发票信息<span class="inv-tips">
<Icon
type="ios-alert-outline"
/>
@ -168,29 +146,19 @@
</div>
<div v-if="couponList.length === 0"></div>
<ul v-else class="coupon-list">
<li
v-for="(item, index) in couponList"
class="coupon-item"
:key="index"
>
<li v-for="(item, index) in couponList" class="coupon-item" :key="index">
<div class="c-left">
<div>
<span
v-if="item.couponType === 'PRICE'"
class="fontsize_12 global_color"
><span class="price">{{
item.price | unitPrice
}}</span></span
<span v-if="item.couponType === 'PRICE'" class="fontsize_12 global_color"
><span class="price">{{ item.price | unitPrice }}</span></span
>
<span
v-if="item.couponType === 'DISCOUNT'"
class="fontsize_12 global_color"
><span class="price">{{ item.discount }}</span
></span
>
<span class="describe"
>{{ item.consumeThreshold }}元可用</span
><span class="price">{{ item.discount }}</span
></span
>
<span class="describe">{{ item.consumeThreshold }}元可用</span>
</div>
<p>使用范围{{ useScope(item.scopeType) }}</p>
<p>有效期{{ item.endTime }}</p>
@ -207,7 +175,7 @@
class="c-right"
v-if="usedCouponId.includes(item.id)"
@click="useCoupon(item.id, false)"
>放弃优惠</a
>放弃优惠</a
>
<i class="circle-top"></i>
<i class="circle-bottom"></i>
@ -220,32 +188,22 @@
<span>{{ totalNum }}件商品总商品金额</span
><span>{{ priceDetailDTO.goodsPrice | unitPrice("¥") }}</span>
</div>
<div v-if="priceDetailDTO.freightPrice>0">
<div v-if="priceDetailDTO.freightPrice > 0">
<span>运费</span
><span>{{ priceDetailDTO.freightPrice | unitPrice("¥") }}</span>
</div>
<div v-if="priceDetailDTO.discountPrice>0">
<div v-if="priceDetailDTO.discountPrice > 0">
<span>优惠金额</span
><span
>-{{
priceDetailDTO.discountPrice | unitPrice("¥")
}}</span
>
><span>-{{ priceDetailDTO.discountPrice | unitPrice("¥") }}</span>
</div>
<div v-if="priceDetailDTO.couponPrice>0">
<div v-if="priceDetailDTO.couponPrice > 0">
<span>优惠券金额</span
><span
>-{{
priceDetailDTO.couponPrice | unitPrice("¥")
}}</span
>
><span>-{{ priceDetailDTO.couponPrice | unitPrice("¥") }}</span>
</div>
<div v-if="$route.query.way === 'POINTS'">
<span>应付积分</span
><span class="actrual-price">{{
priceDetailDTO.payPoint
}}</span>
><span class="actrual-price">{{ priceDetailDTO.payPoint }}</span>
</div>
<div v-else>
<span>应付金额</span
@ -267,73 +225,65 @@
</div>
<BaseFooter></BaseFooter>
<!-- 添加发票模态框 -->
<invoice-modal
ref="invModal"
:invoiceData="invoiceData"
@change="getInvMsg"
/>
<invoice-modal ref="invModal" :invoiceData="invoiceData" @change="getInvMsg" />
<!-- 选择地址模态框 -->
<address-manage
ref="address"
:id="addrId"
@change="addrChange"
></address-manage>
<address-manage ref="address" :id="addrId" @change="addrChange"></address-manage>
</div>
</template>
<script>
import invoiceModal from '@/components/invoiceModal';
import addressManage from '@/components/addressManage';
import {memberAddress, delMemberAddress} from '@/api/address';
import invoiceModal from "@/components/invoiceModal";
import addressManage from "@/components/addressManage";
import { memberAddress, delMemberAddress } from "@/api/address";
import {
cartGoodsPay,
createTrade,
selectAddr,
selectCoupon,
couponNum
} from '@/api/cart';
import {canUseCouponList} from '@/api/member.js';
couponNum,
} from "@/api/cart";
import { canUseCouponList } from "@/api/member.js";
export default {
name: 'Pay',
components: {invoiceModal, addressManage},
data () {
name: "Pay",
components: { invoiceModal, addressManage },
data() {
return {
stepIndex: 1, //
invoiceAvailable: false, //
showEditBtn: '', //
orderMark: '', //
showEditBtn: "", //
orderMark: "", //
invoiceData: {
//
receiptTitle: '个人',
receiptContent: '不开发票'
receiptTitle: "个人",
receiptContent: "不开发票",
},
addressList: [], //
selectedAddress: {}, //
goodsList: [], //
priceDetailDTO: {}, //
totalNum: 0, //
addrId: '', // id
addrId: "", // id
moreAddr: false, //
canUseCouponNum: 0, //
couponList: [], //
usedCouponId: [], // 使id
selectedCoupon: {} //
selectedCoupon: {}, //
};
},
mounted () {
mounted() {
this.init();
},
methods: {
//
init () {
init() {
this.getGoodsDetail();
},
goAddressManage () {
goAddressManage() {
//
this.$router.push('/home/MyAddress');
this.$router.push("/home/MyAddress");
},
getAddress () {
getAddress() {
//
memberAddress().then((res) => {
if (res.success) {
@ -346,10 +296,10 @@ export default {
}
});
},
getGoodsDetail () {
getGoodsDetail() {
//
this.$Spin.show();
cartGoodsPay({way: this.$route.query.way})
cartGoodsPay({ way: this.$route.query.way })
.then((res) => {
this.$Spin.hide();
if (res.success) {
@ -358,22 +308,23 @@ export default {
this.skuList = res.result.skuList;
if (res.result.receiptVO) {
this.invoiceData = res.result.receiptVO
this.invoiceData = res.result.receiptVO;
}
let notSupArea = res.result.notSupportFreight;
this.selectedCoupon = {};
if (res.result.platformCoupon) this.selectedCoupon.platformCoupon = res.result.platformCoupon;
if (res.result.platformCoupon)
this.selectedCoupon.platformCoupon = res.result.platformCoupon;
Object.assign(this.selectedCoupon, res.result.storeCoupons);
if (notSupArea) {
let content = [];
let title = '';
let title = "";
notSupArea.forEach((e) => {
title = e.errorMessage;
content.push(e.goodsSku.goodsName);
});
this.$Modal.warning({
title: '以下商品超出配送区域' || title,
content: content.toString()
title: "以下商品超出配送区域" || title,
content: content.toString(),
});
}
if (res.result.memberAddress) {
@ -384,16 +335,28 @@ export default {
for (let i = 0; i < this.skuList.length; i++) {
this.totalNum += this.skuList[i].num;
}
this.getCouponNum();
this.usedCouponId = [];
this.couponList = res.result.canUseCoupons;
const couponKeys = Object.keys(this.selectedCoupon);
if (couponKeys.length) {
this.couponList.forEach((e) => {
if (e.id === this.selectedCoupon[couponKeys].memberCoupon.id) {
this.usedCouponId.push(e.id);
}
});
this.$nextTick(() => {
this.$forceUpdate();
});
}
}
})
.catch(() => {
this.$Spin.hide();
});
},
getCouponNum () {
getCouponNum() {
//
couponNum({way: this.$route.query.way}).then((res) => {
couponNum({ way: this.$route.query.way }).then((res) => {
this.canUseCouponNum = res.result;
if (res.result) {
let storeArr = [];
@ -407,10 +370,10 @@ export default {
let params = {
pageNumber: 1,
pageSize: 100,
memberCouponStatus: 'NEW',
memberCouponStatus: "NEW",
scopeId: skuArr.toString(),
storeId: storeArr.toString(),
totalPrice: this.priceDetailDTO.goodsPrice
totalPrice: this.priceDetailDTO.goodsPrice,
};
canUseCouponList(params).then((res) => {
//
@ -431,78 +394,77 @@ export default {
}
});
},
selectAddress (item) {
selectAddress(item) {
//
let params = {
way: this.$route.query.way,
shippingAddressId: item.id
shippingAddressId: item.id,
};
selectAddr(params).then((res) => {
if (res.success) {
this.$Message.success('选择收货地址成功');
this.$Message.success("选择收货地址成功");
this.selectedAddress = item;
this.getGoodsDetail();
}
});
},
editAddress (id) {
editAddress(id) {
//
this.addrId = id;
this.$refs.address.show();
},
addrChange () {
addrChange() {
//
this.getAddress();
},
delAddress (item) {
delAddress(item) {
//
this.$Modal.confirm({
title: '提示',
content: '你确定删除这个收货地址',
title: "提示",
content: "你确定删除这个收货地址",
onOk: () => {
delMemberAddress(item.id).then((res) => {
if (res.success) {
this.$Message.success('删除成功');
this.$Message.success("删除成功");
this.getAddress();
}
});
},
onCancel: () => {
}
onCancel: () => {},
});
},
goGoodsDetail (skuId, goodsId) {
goGoodsDetail(skuId, goodsId) {
//
let routeUrl = this.$router.resolve({
path: '/goodsDetail',
query: {skuId, goodsId}
path: "/goodsDetail",
query: { skuId, goodsId },
});
window.open(routeUrl.href, '_blank');
window.open(routeUrl.href, "_blank");
},
//
goShopPage (id) {
goShopPage(id) {
let routeUrl = this.$router.resolve({
path: '/Merchant',
query: {id: id}
path: "/Merchant",
query: { id: id },
});
window.open(routeUrl.href, '_blank');
window.open(routeUrl.href, "_blank");
},
useCoupon (id, used) {
useCoupon(id, used) {
// 使
let params = {
way: this.$route.query.way,
memberCouponId: id,
used: used // true 使 false
used: used, // true 使 false
};
selectCoupon(params).then((res) => {
if (res.success) this.init();
});
},
editInvoice () {
editInvoice() {
//
this.$refs.invModal.invoiceAvailable = true;
},
getInvMsg (item) {
getInvMsg(item) {
//
if (item) {
this.init();
@ -510,18 +472,18 @@ export default {
}
},
pay () {
pay() {
//
const params = {
client: 'PC',
client: "PC",
remark: [],
way: this.$route.query.way
way: this.$route.query.way,
};
this.goodsList.forEach((e) => {
if (e.remark) {
params.remark.push({
remark: e.remark,
storeId: e.storeId
storeId: e.storeId,
});
}
});
@ -533,12 +495,13 @@ export default {
.then((res) => {
this.$Spin.hide();
if (res.success) {
if (params.way === 'POINTS') { //
this.$router.push('/payDone')
if (params.way === "POINTS") {
//
this.$router.push("/payDone");
} else {
this.$router.push({
path: '/payment',
query: {orderType: 'TRADE', sn: res.result.sn}
path: "/payment",
query: { orderType: "TRADE", sn: res.result.sn },
});
}
}
@ -548,28 +511,28 @@ export default {
});
},
//
useScope (type) {
let goods = '全部商品';
useScope(type) {
let goods = "全部商品";
switch (type) {
case 'ALL':
goods = '全部商品';
case "ALL":
goods = "全部商品";
break;
case 'PORTION_GOODS':
goods = '部分商品';
case "PORTION_GOODS":
goods = "部分商品";
break;
case 'PORTION_GOODS_CATEGORY':
goods = '部分分类商品';
case "PORTION_GOODS_CATEGORY":
goods = "部分分类商品";
break;
}
return `${goods}可用`;
}
}
},
},
};
</script>
<style scoped lang="scss">
@import "../../assets/styles/coupon.scss";
.goods-msg{
.goods-msg {
overflow: hidden;
}
/** logo start */
@ -781,7 +744,7 @@ export default {
.goods-item {
display: flex;
width:100%;
width: 100%;
align-items: center;
justify-content: space-between;
padding: 20px 0;
@ -807,12 +770,11 @@ export default {
flex: 1;
text-align: left;
>span{
> span {
margin-left: 10px;
}
}
> span:last-child {
color: $theme_color;
font-weight: bold;

View File

@ -7,7 +7,7 @@
inline
:label-width="70"
class="search-form"
@keydown.enter.native="handleSearch"
@keydown.enter.native="handleSearch"
>
<Form-item label="商品名称" prop="goodsName">
<Input
@ -39,12 +39,19 @@
</Select>
</Form-item>
<Form-item label="商品类型" prop="status">
<Select v-model="searchForm.goodsType" placeholder="请选择" clearable style="width: 200px">
<Select
v-model="searchForm.goodsType"
placeholder="请选择"
clearable
style="width: 200px"
>
<Option value="PHYSICAL_GOODS">实物商品</Option>
<Option value="VIRTUAL_GOODS">虚拟商品</Option>
</Select>
</Form-item>
<Button @click="handleSearch" class="search-btn" type="primary" icon="ios-search" >搜索</Button>
<Button @click="handleSearch" class="search-btn" type="primary" icon="ios-search"
>搜索</Button
>
</Form>
<Table
:loading="loading"
@ -55,25 +62,39 @@
class="mt_10"
>
<!-- 商品栏目格式化 -->
<template slot="goodsSlot" slot-scope="{row}">
<div style="margin: 5px 0px;height: 80px; display: flex;">
<template slot="goodsSlot" slot-scope="{ row }">
<div style="margin: 5px 0px; height: 80px; display: flex">
<div style="">
<img :src="row.original" style="height: 60px;margin-top: 1px;width: 60px">
<img
:src="row.original"
style="height: 60px; margin-top: 1px; width: 60px"
/>
</div>
<div style="margin-left: 13px;">
<div style="margin-left: 13px">
<div class="div-zoom">
<a @click="linkTo(row.id,row.skuId)">{{row.goodsName}}</a>
<a @click="linkTo(row.id, row.skuId)">{{ row.goodsName }}</a>
</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>
<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="">
<img
src="../../../assets/qrcode.svg"
class="hover-pointer"
width="20"
height="20"
alt=""
/>
</Poptip>
</div>
</div>
</template>
</Table>
<Row type="flex" justify="end" class="mt_10">
@ -91,26 +112,15 @@
></Page>
</Row>
</Card>
<Modal
title="下架操作"
v-model="modalVisible"
:mask-closable="false"
:width="500"
>
<Form
ref="underForm"
:model="underForm"
:label-width="100"
>
<Modal title="下架操作" v-model="modalVisible" :mask-closable="false" :width="500">
<Form ref="underForm" :model="underForm" :label-width="100">
<FormItem label="下架原因" prop="reason">
<Input v-model="underForm.reason" clearable style="width: 100%" />
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="modalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="lower"
>提交</Button
>
<Button type="primary" :loading="submitLoading" @click="lower"></Button>
</div>
</Modal>
</div>
@ -118,10 +128,10 @@
<script>
import { getGoodsListData, upGoods, lowGoods } from "@/api/goods";
import vueQr from 'vue-qr'
import vueQr from "vue-qr";
export default {
components: {
"vue-qr":vueQr
"vue-qr": vueQr,
},
name: "goods",
data() {
@ -136,7 +146,8 @@ export default {
sort: "create_time", //
order: "desc", //
},
underForm: { //
underForm: {
//
reason: "",
},
submitLoading: false, //
@ -151,17 +162,14 @@ export default {
title: "商品编号",
key: "id",
minWidth: 150,
tooltip: true
tooltip: true,
},
{
title: "价格",
key: "price",
width: 130,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.price, "¥")
);
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
},
},
{
@ -169,12 +177,12 @@ export default {
key: "goodsType",
width: 130,
render: (h, params) => {
if (params.row.goodsType === 'PHYSICAL_GOODS') {
return h("Tag", {props: {color: "green",},}, "实物商品");
} else if (params.row.goodsType === 'VIRTUAL_GOODS') {
return h("Tag", {props: {color: "volcano",},}, "虚拟商品");
if (params.row.goodsType === "PHYSICAL_GOODS") {
return h("Tag", { props: { color: "green" } }, "实物商品");
} else if (params.row.goodsType === "VIRTUAL_GOODS") {
return h("Tag", { props: { color: "volcano" } }, "虚拟商品");
} else {
return h("Tag", {props: {color: "geekblue",},}, "电子卡券");
return h("Tag", { props: { color: "geekblue" } }, "电子卡券");
}
},
},
@ -184,23 +192,23 @@ export default {
width: 100,
render: (h, params) => {
if (params.row.marketEnable == "DOWN") {
return h("Tag", {props: {color: "volcano"},},"下架");
return h("Tag", { props: { color: "volcano" } }, "下架");
} else if (params.row.marketEnable == "UPPER") {
return h("Tag", {props: {color: "green",},},"上架");
return h("Tag", { props: { color: "green" } }, "上架");
}
},
},
{
title: "审核状态",
key: "isAuth",
key: "authFlag",
width: 130,
render: (h, params) => {
if (params.row.isAuth == "TOBEAUDITED") {
return h("Tag", {props: {color: "volcano",},},"待审核");
} else if (params.row.isAuth == "PASS") {
return h("Tag", {props: {color: "green"},},"通过");
} else if (params.row.isAuth == "REFUSE") {
return h("Tag", {props: {color: "red",},},"拒绝");
if (params.row.authFlag == "TOBEAUDITED") {
return h("Tag", { props: { color: "volcano" } }, "待审核");
} else if (params.row.authFlag == "PASS") {
return h("Tag", { props: { color: "green" } }, "通过");
} else if (params.row.authFlag == "REFUSE") {
return h("Tag", { props: { color: "red" } }, "拒绝");
}
},
},
@ -208,7 +216,7 @@ export default {
title: "店铺名称",
key: "storeName",
minWidth: 100,
tooltip: true
tooltip: true,
},
{
title: "操作",
@ -236,7 +244,8 @@ export default {
},
},
"上架"
), h(
),
h(
"Button",
{
props: {
@ -249,7 +258,7 @@ export default {
},
},
"查看"
)
),
]);
} else {
return h("div", [
@ -270,7 +279,8 @@ export default {
},
},
"下架"
), h(
),
h(
"Button",
{
props: {
@ -283,7 +293,7 @@ export default {
},
},
"查看"
)
),
]);
}
},
@ -369,7 +379,7 @@ export default {
name: "goods-detail",
query: { id: id },
});
}
},
},
mounted() {
this.init();

View File

@ -27,7 +27,9 @@
style="width: 200px"
/>
</Form-item>
<Button @click="handleSearch" class="search-btn" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleSearch" class="search-btn" type="primary" icon="ios-search"
>搜索</Button
>
</Form>
<Table
:loading="loading"
@ -39,18 +41,20 @@
>
<!-- 商品栏目格式化 -->
<template slot="goodsSlot" slot-scope="scope">
<div style="margin-top: 5px;height: 80px; display: flex;">
<div style="margin-top: 5px; height: 80px; display: flex">
<div style="">
<img :src="scope.row.original" style="height: 60px;margin-top: 3px;width: 60px">
<img
:src="scope.row.original"
style="height: 60px; margin-top: 3px; width: 60px"
/>
</div>
<div style="margin-left: 13px">
<div class="div-zoom" >
<a>{{scope.row.goodsName}}</a>
<div class="div-zoom">
<a>{{ scope.row.goodsName }}</a>
</div>
</div>
</div>
</template>
</Table>
<Row type="flex" justify="end" class="mt_10">
@ -72,220 +76,224 @@
</template>
<script>
import {authGoods, getAuthGoodsListData} from "@/api/goods";
import { authGoods, getAuthGoodsListData } from "@/api/goods";
export default {
name: "goods",
components: {},
data() {
return {
id: "", //id
loading: true, //
searchForm: {
//
pageNumber: 1, //
pageSize: 10, //
sort: "create_time", //
order: "desc", //
export default {
name: "goods",
components: {},
data() {
return {
id: "", //id
loading: true, //
searchForm: {
//
pageNumber: 1, //
pageSize: 10, //
sort: "create_time", //
order: "desc", //
},
goodsAuditForm: {
//
is_auth: 1,
},
columns: [
{
title: "商品名称",
key: "goodsName",
minWidth: 180,
slot: "goodsSlot",
tooltip: true,
},
goodsAuditForm: { //
is_auth: 1,
{
title: "商品编号",
key: "id",
minWidth: 100,
tooltip: true,
},
columns: [
{
title: "商品名称",
key: "goodsName",
minWidth: 180,
slot: "goodsSlot",
tooltip: true
{
title: "价格",
key: "price",
minWidth: 130,
render: (h, params) => {
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
},
{
title: "商品编号",
key: "id",
minWidth: 100,
tooltip: true
},
{
title: "价格",
key: "price",
minWidth: 130,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.price, "¥")
);
},
},
{
title: "审核状态",
key: "isAuth",
minWidth: 130,
render: (h, params) => {
if (params.row.isAuth == "TOBEAUDITED") {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "待审核",
},
}),
]);
} else if (params.row.isAuth == "PASS") {
return h("div", [
h("Badge", {
props: {
status: "success",
text: "审核通过",
},
}),
]);
} else if (params.row.isAuth == "REFUSE") {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "审核拒绝",
},
}),
]);
}
},
},
{
title: "店铺名称",
key: "storeName",
minWidth: 100,
tooltip: true
},
{
title: "操作",
key: "action",
align: "center",
fixed: "right",
width: 200,
render: (h, params) => {
},
{
title: "审核状态",
key: "authFlag",
minWidth: 130,
render: (h, params) => {
if (params.row.authFlag == "TOBEAUDITED") {
return h("div", [
h(
"Button",
{
props: {
type: "success",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.examine(params.row, 1);
},
},
h("Badge", {
props: {
status: "error",
text: "待审核",
},
"通过"
),
h(
"Button",
{
props: {
type: "error",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.examine(params.row, 2);
},
},
},
"拒绝"
), h(
"Button",
{
props: {
size: "small",
},
on: {
click: () => {
this.showDetail(params.row);
},
},
},
"查看"
)
}),
]);
},
} else if (params.row.authFlag == "PASS") {
return h("div", [
h("Badge", {
props: {
status: "success",
text: "审核通过",
},
}),
]);
} else if (params.row.authFlag == "REFUSE") {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "审核拒绝",
},
}),
]);
}
},
],
data: [], //
total: 0, //
};
},
methods: {
init() { //
this.getDataList();
},
changePage(v) { //
this.searchForm.pageNumber = v;
this.getDataList();
},
changePageSize(v) { //
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() { //
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
getDataList() { //
this.loading = true;
//
this.searchForm.isAuth = 0;
getAuthGoodsListData(this.searchForm).then((res) => {
this.loading = false;
if (res.records) {
this.data = res.records;
this.total = res.total;
}
});
},
examine(v, isAuth) { //
let examine = "通过";
this.goodsAuditForm.isAuth = "PASS";
if (isAuth != 1) {
examine = "拒绝";
this.goodsAuditForm.isAuth = "REFUSE";
}
this.$Modal.confirm({
title: "确认审核",
content: "您确认要审核" + examine + " " + v.goodsName + " ?",
loading: true,
onOk: () => {
authGoods(v.id, this.goodsAuditForm).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("审核成功");
this.getDataList();
}
});
},
});
},
//
showDetail(v) {
let id = v.id;
this.$router.push({
name: "goods-detail",
query: { id: id },
});
},
},
mounted() {
this.init();
},
};
</script>
},
{
title: "店铺名称",
key: "storeName",
minWidth: 100,
tooltip: true,
},
{
title: "操作",
key: "action",
align: "center",
fixed: "right",
width: 200,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "success",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.examine(params.row, 1);
},
},
},
"通过"
),
h(
"Button",
{
props: {
type: "error",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.examine(params.row, 2);
},
},
},
"拒绝"
),
h(
"Button",
{
props: {
size: "small",
},
on: {
click: () => {
this.showDetail(params.row);
},
},
},
"查看"
),
]);
},
},
],
data: [], //
total: 0, //
};
},
methods: {
init() {
//
this.getDataList();
},
changePage(v) {
//
this.searchForm.pageNumber = v;
this.getDataList();
},
changePageSize(v) {
//
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
//
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
getDataList() {
//
this.loading = true;
//
this.searchForm.authFlag = 0;
getAuthGoodsListData(this.searchForm).then((res) => {
this.loading = false;
if (res.records) {
this.data = res.records;
this.total = res.total;
}
});
},
examine(v, authFlag) {
//
let examine = "通过";
this.goodsAuditForm.authFlag = "PASS";
if (authFlag != 1) {
examine = "拒绝";
this.goodsAuditForm.authFlag = "REFUSE";
}
this.$Modal.confirm({
title: "确认审核",
content: "您确认要审核" + examine + " " + v.goodsName + " ?",
loading: true,
onOk: () => {
authGoods(v.id, this.goodsAuditForm).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("审核成功");
this.getDataList();
}
});
},
});
},
//
showDetail(v) {
let id = v.id;
this.$router.push({
name: "goods-detail",
query: { id: id },
});
},
},
mounted() {
this.init();
},
};
</script>

View File

@ -53,7 +53,7 @@ export default {
sn: "",
categoryPath: "",
marketEnable: "UPPER",
isAuth: "PASS",
authFlag: "PASS",
},
category: [], //
goodsData: [], //

View File

@ -54,12 +54,12 @@
</FormItem>
<FormItem label="优惠方式">
<RadioGroup type="button" button-style="solid" v-model="form.discountType">
<Radio label="isFullMinus" disabled>减现金</Radio>
<Radio label="isFullRate" disabled>打折</Radio>
<Radio label="fullMinusFlag" disabled>减现金</Radio>
<Radio label="fullRateFlag" disabled>打折</Radio>
</RadioGroup>
</FormItem>
<FormItem
v-if="form.discountType == 'isFullMinus'"
v-if="form.discountType == 'fullMinusFlag'"
label="优惠金额"
prop="fullMinus"
>
@ -73,7 +73,7 @@
/>
</FormItem>
<FormItem
v-if="form.discountType == 'isFullRate'"
v-if="form.discountType == 'fullRateFlag'"
label="优惠折扣"
prop="fullRate"
>
@ -88,12 +88,12 @@
<span class="describe">优惠折扣为0-10之间数字可有一位小数</span>
</FormItem>
<FormItem label="额外赠送">
<Checkbox v-model="form.isFreeFreight" disabled>免邮费</Checkbox>&nbsp;
<Checkbox v-model="form.isCoupon" disabled>送优惠券</Checkbox>&nbsp;
<Checkbox v-model="form.isGift" disabled>送赠品</Checkbox>&nbsp;
<Checkbox v-model="form.isPoint" disabled>送积分</Checkbox>
<Checkbox v-model="form.freeFreightFlag" disabled>免邮费</Checkbox>&nbsp;
<Checkbox v-model="form.couponFlag" disabled>送优惠券</Checkbox>&nbsp;
<Checkbox v-model="form.giftFlag" disabled>送赠品</Checkbox>&nbsp;
<Checkbox v-model="form.pointFlag" disabled>送积分</Checkbox>
</FormItem>
<FormItem v-if="form.isCoupon" label="赠送优惠券" prop="couponId">
<FormItem v-if="form.couponFlag" label="赠送优惠券" prop="couponId">
<Select
v-model="form.couponId"
filterable
@ -108,7 +108,7 @@
}}</Option>
</Select>
</FormItem>
<FormItem v-if="form.isGift" label="赠品" prop="giftId">
<FormItem v-if="form.giftFlag" label="赠品" prop="giftId">
<Select
v-model="form.giftId"
filterable
@ -123,7 +123,7 @@
}}</Option>
</Select>
</FormItem>
<FormItem v-if="form.isPoint" label="赠积分" prop="point">
<FormItem v-if="form.pointFlag" label="赠积分" prop="point">
<Input v-model="form.point" type="number" disabled style="width: 260px" />
</FormItem>
<FormItem label="使用范围" prop="scopeType">
@ -187,7 +187,7 @@ export default {
return {
form: {
//
discountType: "isFullMinus",
discountType: "fullMinusFlag",
scopeType: "ALL",
promotionGoodsList: [],
},
@ -242,12 +242,12 @@ export default {
if (!data.scopeType === "ALL") {
data.promotionGoodsList = [];
}
if (data.isFullMinus) {
data.discountType = "isFullMinus";
delete data.isFullMinus;
if (data.fullMinusFlag) {
data.discountType = "fullMinusFlag";
delete data.fullMinusFlag;
} else {
data.discountType = "isFullMinus";
delete data.isFullRate;
data.discountType = "fullMinusFlag";
delete data.fullRateFlag;
}
data.rangeTime = [];
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));

View File

@ -63,7 +63,7 @@
{{ unixDate(row.applyEndTime) }}
</template>
<template slot-scope="{ row }" slot="promotionType">
{{ row.isFullMinus ? "满减" : "满折" }}
{{ row.fullMinusFlag ? "满减" : "满折" }}
</template>
<template slot-scope="{ row }" slot="hours">
<Tag v-for="item in unixHours(row.hours)" :key="item">{{ item }}</Tag>

View File

@ -156,14 +156,14 @@ export default {
},
{
title: "审核状态",
key: "isAuth",
key: "authFlag",
width: 130,
render: (h, params) => {
if (params.row.isAuth == "TOBEAUDITED") {
if (params.row.authFlag == "TOBEAUDITED") {
return h("Tag", {props: {color: "blue",},},"待审核");
} else if (params.row.isAuth == "PASS") {
} else if (params.row.authFlag == "PASS") {
return h("Tag", {props: {color: "green",},},"通过");
} else if (params.row.isAuth == "REFUSE") {
} else if (params.row.authFlag == "REFUSE") {
return h("Tag", {props: {color: "red",},},"审核拒绝");
}
},
@ -250,14 +250,14 @@ export default {
},
{
title: "审核状态",
key: "isAuth",
key: "authFlag",
width: 120,
render: (h, params) => {
if (params.row.isAuth == "PASS") {
if (params.row.authFlag == "PASS") {
return h("Tag", {props: {color: "green"}},"通过");
} else if (params.row.isAuth == "TOBEAUDITED") {
} else if (params.row.authFlag == "TOBEAUDITED") {
return h("Tag", {props: {color: "volcano"}},"待审核");
} else if (params.row.isAuth == "REFUSE") {
} else if (params.row.authFlag == "REFUSE") {
return h("Tag", {props: {color: "red"}},"审核拒绝");
}
},

View File

@ -64,7 +64,7 @@ export default {
sn: "",
categoryPath: "",
marketEnable: "UPPER",
isAuth: "PASS",
authFlag: "PASS",
},
category: [], //
goodsData: [], //

View File

@ -54,16 +54,16 @@
</FormItem>
<FormItem label="优惠方式">
<RadioGroup type="button" button-style="solid" v-model="form.discountType">
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullMinus"
<Radio :disabled="form.promotionStatus != 'NEW'" label="fullMinusFlag"
>减现金</Radio
>
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullRate"
<Radio :disabled="form.promotionStatus != 'NEW'" label="fullRateFlag"
>打折</Radio
>
</RadioGroup>
</FormItem>
<FormItem
v-if="form.discountType == 'isFullMinus'"
v-if="form.discountType == 'fullMinusFlag'"
label="优惠金额"
prop="fullMinus"
>
@ -77,7 +77,7 @@
/>
</FormItem>
<FormItem
v-if="form.discountType == 'isFullRate'"
v-if="form.discountType == 'fullRateFlag'"
label="优惠折扣"
prop="fullRate"
>
@ -94,13 +94,15 @@
<FormItem label="额外赠送">
<Checkbox
:disabled="form.promotionStatus != 'NEW'"
v-model="form.isFreeFreight"
v-model="form.freeFreightFlag"
>免邮费</Checkbox
>
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isCoupon"
<Checkbox
:disabled="form.promotionStatus != 'NEW'"
v-model="form.couponFlag"
>送优惠券</Checkbox
>
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isGift"
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.giftFlag"
>送赠品</Checkbox
>
<Checkbox
@ -109,11 +111,11 @@
Cookies.get('userInfoSeller') &&
JSON.parse(Cookies.get('userInfoSeller')).selfOperated
"
v-model="form.isPoint"
v-model="form.pointFlag"
>送积分</Checkbox
>
</FormItem>
<FormItem v-if="form.isCoupon" label="赠送优惠券" prop="couponId">
<FormItem v-if="form.couponFlag" label="赠送优惠券" prop="couponId">
<Select
v-model="form.couponId"
:disabled="form.promotionStatus != 'NEW'"
@ -128,7 +130,7 @@
}}</Option>
</Select>
</FormItem>
<FormItem v-if="form.isGift" label="赠品" prop="giftId">
<FormItem v-if="form.giftFlag" label="赠品" prop="giftId">
<Select
:disabled="form.promotionStatus != 'NEW'"
v-model="form.giftId"
@ -143,7 +145,7 @@
}}</Option>
</Select>
</FormItem>
<FormItem v-if="form.isPoint" label="赠积分" prop="point">
<FormItem v-if="form.pointGift" label="赠积分" prop="point">
<InputNumber
:min="0"
:disabled="form.promotionStatus != 'NEW'"
@ -265,7 +267,7 @@ export default {
Cookies,
form: {
//
discountType: "isFullMinus",
discountType: "fullMinusFlag",
scopeType: "ALL",
promotionGoodsList: [],
promotionStatus: "NEW",
@ -370,12 +372,12 @@ export default {
if (data.scopeType === "ALL") {
data.promotionGoodsList = [];
}
if (data.isFullMinus) {
data.discountType = "isFullMinus";
delete data.isFullMinus;
if (data.fullMinusFlag) {
data.discountType = "fullMinusFlag";
delete data.fullMinusFlag;
} else {
data.discountType = "isFullRate";
delete data.isFullRate;
data.discountType = "fullRateFlag";
delete data.fullRateFlag;
}
data.rangeTime = [];
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));
@ -410,10 +412,10 @@ export default {
e.endTime = params.endTime;
});
}
if (params.discountType == "isFullMinus") {
params.isFullMinus = true;
if (params.discountType == "fullMinusFlag") {
params.fullMinusFlag = true;
} else {
params.isFullRate = true;
params.fullRateFlag = true;
}
delete params.rangeTime;
this.submitLoading = true;

View File

@ -53,7 +53,7 @@
{{ unixDate(row.applyEndTime) }}
</template>
<template slot-scope="{ row }" slot="promotionType">
{{ row.isFullMinus ? "满减" : "满折" }}
{{ row.fullMinusFlag ? "满减" : "满折" }}
</template>
<template slot-scope="{ row }" slot="hours">
<Tag v-for="item in unixHours(row.hours)" :key="item">{{ item }}</Tag>