积分商品,以及完善砍价商品

master
lemon橪 2021-07-20 18:05:50 +08:00
parent 65a9110ada
commit 0ea121e59e
11 changed files with 272 additions and 37 deletions

View File

@ -51,13 +51,25 @@ export function getPointsCategory() {
* 获取积分商城商品 * 获取积分商城商品
* @param params * @param params
*/ */
export function getPointsGoods(params) { export function getPointsGoods(params) {
return http.request({ return http.request({
url: "/promotion/pointsGoods", url: "/promotion/pointsGoods",
method: Method.GET, method: Method.GET,
params, params,
}); });
} }
/**
* 获取积分商城商品详情
* @param params
*/
export function getPointsGoodsDetail(id) {
return http.request({
url: "/promotion/pointsGoods/"+id,
method: Method.GET,
});
}
/** /**
* 获取限时抢购时间线 当天限时抢购信息 * 获取限时抢购时间线 当天限时抢购信息

View File

@ -4,23 +4,27 @@
*/ */
// 开发环境 // 开发环境
const dev = { const dev = {
common: "https://common-api.pickmall.cn", // common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn", // buyer: "https://buyer-api.pickmall.cn",
common: 'http://192.168.0.101:8890',
buyer: 'http://192.168.0.101:8888',
seller: 'http://192.168.0.101:8889',
manager: 'http://192.168.0.101:8887'
}; };
// 生产环境 // 生产环境
const prod = { const prod = {
common: "https://common-api.pickmall.cn", common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn", buyer: "https://buyer-api.pickmall.cn",
}; };
//默认生产环境 //默认生产环境
let api = dev; let api = dev;
//如果是开发环境 //如果是开发环境
if (process.env.NODE_ENV == "development") { if (process.env.NODE_ENV == "development") {
api = dev; api = dev;
} else { } else {
api = prod; api = prod;
} }
//微信小程序app的打包方式建议为生产环境所以这块直接条件编译赋值 //微信小程序app的打包方式建议为生产环境所以这块直接条件编译赋值
// #ifdef MP-WEIXIN || APP-PLUS // #ifdef MP-WEIXIN || APP-PLUS
@ -30,5 +34,5 @@ api = prod;
api.buyer += "/buyer"; api.buyer += "/buyer";
api.common += "/common"; api.common += "/common";
export default { export default {
...api, ...api,
}; };

View File

@ -497,6 +497,13 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
}
},{
"path": "point/detail",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
} }
} }
@ -745,7 +752,6 @@
"selectedIconPath": "static/tabbar/category-s.png", "selectedIconPath": "static/tabbar/category-s.png",
"text": "分类" "text": "分类"
}, },
// { // {
// "pagePath": "pages/navigation/point/point-mall", // "pagePath": "pages/navigation/point/point-mall",
// "iconPath": "static/tabbar/point-mall.png", // "iconPath": "static/tabbar/point-mall.png",

View File

@ -162,13 +162,12 @@ export default {
* 直接购买 * 直接购买
*/ */
buy(data) { buy(data) {
API_trade.addToCart(data).then((res) => { API_trade.addToCart(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/order/fillorder?way=${data.cartType}&addr=${ url: `/pages/order/fillorder?way=${
this.addr.id || "" data.cartType
}&parentOrder=${encodeURIComponent( }&addr=${""}&parentOrder=${encodeURIComponent(
JSON.stringify(this.parentOrder) JSON.stringify(this.parentOrder)
)}`, )}`,
}); });
@ -213,8 +212,10 @@ export default {
}); });
} else { } else {
// //
if (this.buyType) { if (this.buyType == "PINTUAN") {
data.cartType = "PINTUAN"; data.cartType = "PINTUAN";
} else if (this.buyType == "POINTS") {
data.cartType = "POINTS";
} else { } else {
data.cartType = "BUY_NOW"; data.cartType = "BUY_NOW";
} }
@ -224,7 +225,7 @@ export default {
}, },
formatSku(list) { formatSku(list) {
// //
if (typeof list != Array) return false;
let arr = [{}]; let arr = [{}];
list.forEach((item, index) => { list.forEach((item, index) => {
item.specValues.forEach((spec, specIndex) => { item.specValues.forEach((spec, specIndex) => {

View File

@ -100,6 +100,7 @@ export default {
async onShow() { async onShow() {
// //
let response = await getPointsCategory(); let response = await getPointsCategory();
if (response.data.success) { if (response.data.success) {
let navData = response.data.result.records; let navData = response.data.result.records;
navData.forEach((item) => { navData.forEach((item) => {
@ -130,7 +131,7 @@ export default {
toGoods(item) { toGoods(item) {
// //
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${item.skuId}&goodsId=${item.id}&whetherPoint=1`, url: `/pages/promotion/point/detail?id=${item.id}`,
}); });
}, },

View File

@ -91,6 +91,7 @@
</div> </div>
<p class="sp_number">{{ val.goodsSku.price | unitPrice }}</p> <p class="sp_number">{{ val.goodsSku.price | unitPrice }}</p>
</u-col> </u-col>
</u-row> </u-row>

View File

@ -476,7 +476,6 @@ export default {
this.routerVal.id, this.routerVal.id,
this.routerVal.goodsId, this.routerVal.goodsId,
this.routerVal.distributionId, this.routerVal.distributionId,
this.routerVal.whetherPoint
); );
} }
}, },

View File

@ -93,7 +93,7 @@
<!-- 购买 --> <!-- 购买 -->
<popupGoods :addr="addr" ref="popupGoods" :buyMask="maskFlag" @closeBuy="closePopupBuy" :goodsDetail="bargainDetail" :goodsSpec="goodsSpec" v-if="bargainDetail.id " <popupGoods ref="popupGoods" :buyMask="maskFlag" @closeBuy="closePopupBuy" :goodsDetail="bargainDetail" :goodsSpec="goodsSpec" v-if="bargainDetail.id "
@handleClickSku="getGoodsDetail" /> @handleClickSku="getGoodsDetail" />
<!-- 产品详情 --> <!-- 产品详情 -->
@ -218,22 +218,11 @@ export default {
title: "加载中", title: "加载中",
mask: true, mask: true,
}); });
this.$refs.popupGoods.buy({ this.$refs.popupGoods.buy({
skuId: this.bargainDetail.id, skuId: this.bargainDetail.id,
num: 1, num: 1,
cartType: "KANJIA", cartType: "KANJIA",
}); });
// getGoods(this.bargainDetail.id, this.bargainDetail.goodsId).then(
// (response) => {
// this.goodsDetail = response.data.result.data;
// this.selectedGoods = response.data.result.data;
// this.goodsSpec = response.data.result.specs;
// uni.hideLoading();
// // this.maskFlag = true;
// }
// );
}, },
// //
@ -257,7 +246,7 @@ export default {
let res = await getBargainActivity(this.params); let res = await getBargainActivity(this.params);
// //
res.data.success res.data.success
? res.data.result ? res.data.result.launch
? (this.activityData = res.data.result) ? (this.activityData = res.data.result)
: this.openActivity() : this.openActivity()
: ""; : "";

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="page"> <div class="page">
<u-navbar back-icon-color="#fff" :background="background" :border-bottom="false" title=""></u-navbar> <u-navbar back-icon-color="#fff" :background="background" :border-bottom="false" title=""></u-navbar>
<div class="wrapper"> <div class="wrapper">
<!-- 砍价列表 --> <!-- 砍价列表 -->
<div class="box"> <div class="box">
@ -34,7 +34,7 @@ export default {
data() { data() {
return { return {
background: { background: {
backgroundColor: 'transparent', backgroundColor: "transparent",
}, },
params: { params: {
promotionStatus: "START", /// promotionStatus: "START", ///
@ -45,6 +45,12 @@ export default {
}; };
}, },
onShow() { onShow() {
this.params.pageNumber = 1;
this.bargainList = [];
this.init();
},
onReachBottom() {
this.params.pageNumber++;
this.init(); this.init();
}, },
methods: { methods: {
@ -54,7 +60,7 @@ export default {
async init() { async init() {
let res = await getBargainList(this.params); // let res = await getBargainList(this.params); //
if (res.data.success) { if (res.data.success) {
this.bargainList = res.data.result.records; this.bargainList.push(...res.data.result.records);
} }
}, },
@ -68,12 +74,11 @@ export default {
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
page{ page {
background-color: $light-color !important; background-color: $light-color !important;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.wrapper { .wrapper {
background: url("../static/Bargaining.png"); background: url("../static/Bargaining.png");
background-repeat: no-repeat; background-repeat: no-repeat;

View File

@ -0,0 +1,217 @@
<template>
<div class="page">
<u-navbar :border-bottom="false" title=""></u-navbar>
<div class="wrapper">
<!-- 砍价列表 -->
<div class="box box1">
<div class="bargain">
<div class="row-title">商品信息</div>
<div class="flex row-item">
<div class="goods-img">
<u-image width="200" height="200" :src="goodsData.thumbnail"></u-image>
</div>
<div class="goods-config">
<div class="goods-title wes-2">
{{goodsData.goodsName}}
</div>
<div class="flex price-box">
<div class="purchase-price">积分:<span>{{ pointDetail.points | unitPrice }}</span>
</div>
<div class="max-price">原价:<span>{{ goodsData.price | unitPrice}}</span>
</div>
</div>
<div class="tips">{{goodsData.sellingPoint}}</div>
</div>
</div>
<div class="buy" @click="getGoodsDetail">
立即购买
</div>
</div>
</div>
<!-- 产品详情 -->
<div class="box box3">
<div class="bargain">
<div class="row-title">商品详情</div>
<view class="u-content">
<u-parse :html="goodsData.mobileIntro"></u-parse>
</view>
</div>
</div>
<!-- 购买 -->
<popupGoods ref="popupGoods" :goodsSpec="goodsSpec" :buyMask="maskFlag" @closeBuy="closePopupBuy" :goodsDetail="goodsData" v-if="goodsData.id " @handleClickSku="getGoodsDetail" />
<div class="box4"></div>
</div>
</div>
</template>
<script>
import popupGoods from "@/pages/cart/payment/popup/goods"; //
import { getPointsGoodsDetail } from "@/api/promotions";
export default {
components: {
popupGoods,
},
data() {
return {
maskFlag: false, //
lightColor: this.$lightColor,
goodsData: {}, //
pointDetail: {}, //
goodsDetail: {}, //
goodsSpec: {}, //
selectedGoods: {},
};
},
onLoad(options) {
this.routerVal = options;
},
onShow() {
this.init();
},
watch: {},
methods: {
//
getGoodsDetail() {
uni.showLoading({
title: "加载中",
mask: true,
});
this.$refs.popupGoods.buy({
skuId: this.goodsData.id,
num: 1,
cartType: "POINTS",
});
},
//
async init() {
//
let res = await getPointsGoodsDetail(this.routerVal.id);
if (res.data.success) {
this.goodsData = res.data.result.goodsSku;
this.pointDetail = res.data.result;
}
},
},
};
</script>
<style lang="scss">
</style>
<style lang="scss" scoped>
.page {
min-height: 100vh;
}
.slot-content {
display: flex;
align-items: flex-end;
justify-content: center;
margin: 20rpx 0 80rpx 0;
}
.price {
margin-left: 10rpx;
color: #44a88d;
}
.price-box {
align-items: center;
padding: 10rpx 0;
}
.box {
background: #fff;
border-radius: 20rpx;
position: relative;
margin: 40rpx auto;
> .bargain {
padding: 32rpx;
}
}
.row-item {
align-items: center;
}
.goods-config {
margin-left: 20rpx;
> .goods-title {
font-weight: bold;
}
}
.max-price,
.purchase-price {
font-size: 24rpx;
color: #999;
}
.max-price {
margin-left: 10rpx;
text-decoration: line-through;
}
.purchase-price {
color: #44a88d;
> span {
font-size: 32rpx;
font-weight: bold;
}
}
.buy {
font-size: 24rpx;
color: #fff;
width: 80%;
margin: 50rpx auto 0 auto;
text-align: center;
font-size: 30rpx;
background-image: linear-gradient(25deg, #00627d, #2d8485, #44a88d, #57ce93);
padding: 18rpx;
border-radius: 100px;
}
.line {
margin: 20rpx 0;
}
.tips {
font-size: 24rpx;
color: #999;
justify-content: space-between;
}
.row-progress {
margin: 20rpx 0;
}
.row-title {
font-size: 32rpx;
font-weight: bold;
color: #44a88d;
text-align: center;
margin-bottom: 40rpx;
}
.user-item {
margin: 40rpx 0;
align-items: center;
}
.user-config {
margin-left: 20rpx;
flex: 8;
align-items: center;
justify-content: space-between;
> .user-name {
> div:nth-of-type(1) {
font-size: 28rpx;
}
> div:nth-last-of-type(1) {
font-size: 24rpx;
color: #999;
}
}
}
.mobile-intro {
overflow: hidden;
max-width: 100%;
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB