From 932ebc04c7de380f9f60963486015ad1c1d45011 Mon Sep 17 00:00:00 2001
From: guoxing <1369478551@qq.com>
Date: Thu, 23 Feb 2023 01:38:38 +0800
Subject: [PATCH] =?UTF-8?q?2023-02-23=20=E5=8A=9F=E8=83=BD=E5=AE=8C?=
=?UTF-8?q?=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
mallplusui-uniapp-app/common/api.js | 3 +-
.../components/coolc-coupon/coolc-coupon.vue | 48 +-
mallplusui-uniapp-app/pages/index/index.vue | 30 +-
mallplusui-uniapp-app/pages/index/user.vue | 1253 +++++++++--------
mallplusui-uniapp-app/pagesA/product/list.vue | 4 +-
mallplusui-uniapp-app/pagesU/user/coupon.vue | 2 +-
mallplusui-uniapp-app/store/index.js | 4 +
7 files changed, 726 insertions(+), 618 deletions(-)
diff --git a/mallplusui-uniapp-app/common/api.js b/mallplusui-uniapp-app/common/api.js
index e13126f..eca0a3d 100644
--- a/mallplusui-uniapp-app/common/api.js
+++ b/mallplusui-uniapp-app/common/api.js
@@ -313,6 +313,7 @@ export default {
return res.data.data;
} else {
console.log(">>>>>=");
+ console.log(">>>>>=",res.data);
if (res.data) {
if (!res.data.msg) {
res.data.msg = res.data.data;
@@ -321,7 +322,7 @@ export default {
title: res.data.msg,
icon: 'none'
});
- this.$api.msg(res.data.msg);
+ // this.$api.msg(res.data.msg);
}
}
diff --git a/mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue b/mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue
index 064b2f4..5efefe1 100644
--- a/mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue
+++ b/mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue
@@ -8,10 +8,10 @@
满{{ item.minPoint }} 减 {{ item.amount }}
- 立即领取
- 立即使用
+
@@ -21,6 +21,9 @@
import {
formatDate
} from '@/common/date';
+ import {
+ mapState
+ } from 'vuex';
export default {
components: {
@@ -54,25 +57,34 @@
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
},
+ computed: {
+ ...mapState(['hasLogin', 'userInfo']),
+ },
methods: {
async acceptCoupon(item) {
- this.types = !this.types
- 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);
+ if (this.hasLogin) {
+ this.types = !this.types
+ 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.clickSubMethod(item)
+
+ // }
+ uni.hideLoading();
+ } else {
+ uni.navigateTo({
+ url: '/pages/public/login'
+ });
}
- uni.hideLoading();
-
},
clickSubMethod(vel) {
console.log('clickSubMethod')
diff --git a/mallplusui-uniapp-app/pages/index/index.vue b/mallplusui-uniapp-app/pages/index/index.vue
index 1152648..1b6df48 100644
--- a/mallplusui-uniapp-app/pages/index/index.vue
+++ b/mallplusui-uniapp-app/pages/index/index.vue
@@ -360,19 +360,35 @@
}
},
},
+ computed: {
+ ...mapState(['hasLogin', 'userInfo']),
+ },
methods: {
clickParentMethod() {
console.log('clickParentMethod')
this.$refs.SubComponent.callSubMethod()
},
callParentMethod(val) {
+ let info = val
console.log('callParentMethod: ' + val)
+ console.log('val: ' + val.id)
+ console.log('val: ' + info.id)
// 默认去遍历list集合,将集合中的每个元素传入到function的item里,
- var index = this.couponList.findIndex(function(item) {
- return item.id == val.id;
- })
+ var index = this.couponList.findIndex(
+ // function(item) {
+ // console.log('item: ' + JSON.stringify(item))
+ // console.log('val: ' + val)
+ // return item.id == val.id;
+ item => {
+ console.log('item: ' + JSON.stringify(item).id)
+ console.log('val: ' + val.id)
+ if (item == val) {
+ return true
+ }
+ })
+ console.log('index: ' + index)
this.couponList.splice(index, 1);
-
+ // this.getCouponList();
},
async sysInfoMethod() {
@@ -526,7 +542,7 @@
}
},
/**
- * 获取轮播图
+ * 获取优惠券
*/
async getCouponList() {
let params = {
@@ -536,7 +552,9 @@
if (data) {
console.log("优惠券")
console.log("优惠券", data)
- this.couponList = data || [];
+ console.log("优惠券id",data[0].id)
+ this.couponList = []
+ this.couponList = this.couponList.concat(data) || [];
}
},
/**
diff --git a/mallplusui-uniapp-app/pages/index/user.vue b/mallplusui-uniapp-app/pages/index/user.vue
index 6035b96..4cdc1df 100644
--- a/mallplusui-uniapp-app/pages/index/user.vue
+++ b/mallplusui-uniapp-app/pages/index/user.vue
@@ -6,21 +6,30 @@
-
- {{ userDetailInfo.nickname || userDetailInfo.username }}
- 卖家中心
+
+
+
+ {{ userDetailInfo.nickname || userDetailInfo.username }}
+
+
+ 卖家中心
+
-
+
+
-
+
+
-
+
@@ -37,23 +46,17 @@
-
+ ]" @touchstart="coverTouchstart" @touchmove="coverTouchmove" @touchend="coverTouchend">
- {{ userDetailInfo.blance || 0 }}
+ {{ userDetailInfo.blance || 0}}
余额
@@ -67,20 +70,24 @@
-
+
全部订单
-
+
待付款
-
+
待收货
-
+
退款/售后
@@ -92,14 +99,18 @@
浏览历史
-
+
-
-
+
+
-
+
-
+
@@ -147,624 +159,685 @@
diff --git a/mallplusui-uniapp-app/pagesA/product/list.vue b/mallplusui-uniapp-app/pagesA/product/list.vue
index 5ddc2ca..16d763f 100644
--- a/mallplusui-uniapp-app/pagesA/product/list.vue
+++ b/mallplusui-uniapp-app/pagesA/product/list.vue
@@ -20,8 +20,8 @@
{{ item.name }}
- {{ item.price }}
- 市场价 ¥{{ item.originalPrice }}
+ {{ item.originalPrice }}
+ 市场价 ¥{{ item.price }}