2023-3-18

This commit is contained in:
2023-03-18 17:08:47 +08:00
parent b9ee4510db
commit a1abdfe8a7
8 changed files with 1128 additions and 94 deletions

View File

@@ -20,11 +20,13 @@
</view>
<!-- 分类 -->
<view class="cate-section">
<view class="cate-item" @click="navToTabPage('../../pagesA/product/list?productAttributeCategoryId=1005001')">
<view class="cate-item"
@click="navToTabPage('../../pagesA/product/list?productAttributeCategoryId=1005001')">
<image src="/static/nywz_icon.png"></image>
<text>农业物资</text>
</view>
<view class="cate-item" @click="navToTabPage('../../pagesA/product/list?productAttributeCategoryId=1005000')">
<view class="cate-item"
@click="navToTabPage('../../pagesA/product/list?productAttributeCategoryId=1005000')">
<image src="/static/shwz_icon.png"></image>
<text>生活物资</text>
</view>
@@ -112,7 +114,15 @@
</view> -->
<!-- 优惠券 https://s.click.taobao.com/OPh3c1w -->
<coupon v-for="(item, index) in couponList" :key="index" v-bind:item="item" theme="#ff0000" ref="SubComponent"
<view v-if='couponList && couponList.length>0' class="f-header m-t" @click="allAcceptCoupon">
<image src="/static/youhuiquan.png"></image>
<view class="tit-box">
<text class="tit">有可领取优惠券</text>
</view>
<text class="get-btn">全部领取</text>
</view>
<coupon v-for="(item, index) in couponList" :key="index" v-bind:item="item" theme="#EB331E" ref="SubComponent"
@callParentMethod="callParentMethod"></coupon>
<!-- 团购楼层
@@ -269,6 +279,7 @@
} from 'vuex';
import navBar from '@/components/zhouWei-navBar';
import uniLoadMore from '@/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue';
import index from '@/store/index.js';
export default {
components: {
coupon,
@@ -315,6 +326,7 @@
setTimeout(function() {
uni.stopPullDownRefresh();
}, 2000);
},
onShareAppMessage() {},
onLoad(ops) {
@@ -361,7 +373,7 @@
},
},
computed: {
...mapState(['hasLogin', 'userInfo']),
...mapState(['hasLogin', 'hasVip', 'userInfo']),
},
methods: {
clickParentMethod() {
@@ -390,7 +402,47 @@
});
this.getCouponList();
},
async allAcceptCoupon() {
if (this.hasLogin) {
if (this.hasVip) {
uni.showLoading({
title: '请稍后'
});
let params = {
// couponId: item.id
};
// this.clickSubMethod(item)
let data = await Api.apiCall('post', Api.index.acceptCoupon, params);
console.log("data?????", data);
if (data) {
// this.$api.msg(data);
this.couponList = [];
uni.showLoading({
title: '领取成功'
});
this.getCouponList();
}
uni.hideLoading();
} else {
uni.showModal({
title: '提示',
content: '您不属于惠农会员暂不能领取此优惠券',
showCancel: false,
success: function(res) {
if (res.confirm) {
return;
}
}
});
}
} else {
uni.navigateTo({
url: '/pages/public/login'
});
}
},
async sysInfoMethod() {
let params = {};
// let list = this.$db.get('sysInfo')
@@ -503,14 +555,14 @@
pageSize: 4,
productCategoryId: "",
type: 1,
newStatus:1,
newStatus: 1,
productAttributeCategoryId: ""
};
let groupHotGoodsList = await Api.apiCall('get', Api.goods.goodsList, params);
if (groupHotGoodsList) {
this.homeNewProductList = groupHotGoodsList.records;
}
console.log("新品推荐》》》》》", this.homeNewProductList)
console.log("新品推荐》》》》》", this.homeNewProductList)
},
/**
@@ -522,7 +574,7 @@ console.log("新品推荐》》》》》", this.homeNewProductList)
pageSize: 4,
productCategoryId: "",
type: 1,
recommandStatus:1,
recommandStatus: 1,
productAttributeCategoryId: ""
};;
let groupHotGoodsList = await Api.apiCall('get', Api.goods.goodsList, params);
@@ -562,7 +614,7 @@ console.log("新品推荐》》》》》", this.homeNewProductList)
*/
async getCouponList() {
let params = {
pageSize: 3
// pageSize: 3
};
let data = await Api.apiCall('get', Api.index.selectNotRecive, params);
if (data) {
@@ -769,21 +821,21 @@ console.log("新品推荐》》》》》", this.homeNewProductList)
url: `../../pagesA/product/product?id=${id}`
});
},
async acceptCoupon(item) {
uni.showLoading({
title: '请稍后'
});
// async acceptCoupon(item) {
// uni.showLoading({
// title: '请稍后'
// });
let params = {
couponId: item.id
};
let data = await Api.apiCall('post', Api.index.acceptCoupon, params);
console.log(data);
if (data) {
this.$api.msg(data);
}
uni.hideLoading();
},
// let params = {
// couponId: item.id
// };
// let data = await Api.apiCall('post', Api.index.acceptCoupon, params);
// console.log(data);
// if (data) {
// this.$api.msg(data);
// }
// uni.hideLoading();
// },
navToSkillDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
@@ -1099,7 +1151,7 @@ console.log("新品推荐》》》》》", this.homeNewProductList)
color: $uni-color-primary;
line-height: 1;
}
.m-price {
font-size: 16px;
color: $font-color-light;
@@ -1111,7 +1163,7 @@ console.log("新品推荐》》》》》", this.homeNewProductList)
.f-header {
display: flex;
align-items: center;
height: 140upx;
height: 110upx;
padding: 0upx 20upx;
background: #fff;
@@ -1139,6 +1191,22 @@ console.log("新品推荐》》》》》", this.homeNewProductList)
color: $font-color-light;
}
.get-btn {
width: 146upx;
height: 52upx;
line-height: 50upx;
position: absolute;
top: 50%;
right: 36upx;
margin-top: -53upx;
text-align: center;
border-radius: 60upx;
color: #ff9000;
border: 1px solid #ff9000;
font-size: $font-sm;
float: right;
}
.icon-you {
font-size: $font-lg + 2upx;
color: $font-color-light;
@@ -1202,12 +1270,13 @@ console.log("新品推荐》》》》》", this.homeNewProductList)
color: $uni-color-primary;
line-height: 1;
}
.m-price {
font-size: 16px;
color: $font-color-light;
margin-left: 10upx;
}
.pro-box {
display: flex;
align-items: center;
@@ -1273,12 +1342,13 @@ console.log("新品推荐》》》》》", this.homeNewProductList)
color: $uni-color-primary;
line-height: 1;
}
.m-price {
font-size: 16px;
color: $font-color-light;
margin-left: 10upx;
}
.coupon_box {
width: 100%;
height: auto;