From 16a4fd21b1b50242093d17414eed88acf8568d45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=90=BD=E6=97=A5=E6=99=9A=E9=A3=8E?= <1811466536@qq.com>
Date: Wed, 6 Dec 2023 17:56:46 +0800
Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=85=A8=E9=83=A8=E8=AE=A2?=
=?UTF-8?q?=E5=8D=95=EF=BC=8C=E5=BE=85=E5=8F=91=E8=B4=A7-=E5=BE=85?=
=?UTF-8?q?=E8=AF=84=E4=BB=B7-=E8=AF=84=E4=BB=B7=E6=99=92=E5=8D=95=20=20?=
=?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/coupon/list.vue | 459 +++++++++---------
pages/goods/comment/add.vue | 330 +++++++------
pages/order/detail.vue | 10 +-
pages/user/wallet/money.vue | 13 +-
sheep/api/coupon.js | 77 +--
sheep/api/order.js | 12 +-
.../s-coupon-card/s-coupon-card.vue | 142 +++---
.../s-coupon-list/s-coupon-list.vue | 327 ++++++-------
sheep/store/user.js | 302 ++++++------
9 files changed, 892 insertions(+), 780 deletions(-)
diff --git a/pages/coupon/list.vue b/pages/coupon/list.vue
index 4d6a156e..4bb02a0e 100644
--- a/pages/coupon/list.vue
+++ b/pages/coupon/list.vue
@@ -1,242 +1,261 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
- 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
- }"
- @tap="loadmore"
- />
-
+ }" @tap="loadmore" /> -->
+
+ .card-btn {
+ // width: 144rpx;
+ padding: 0 16rpx;
+ height: 50rpx;
+ border-radius: 40rpx;
+ background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
+ color: #ffffff;
+ font-size: 24rpx;
+ font-weight: 400;
+ }
+
+ .border-btn {
+ background: linear-gradient(90deg, var(--ui-BG-Main-opacity-4), var(--ui-BG-Main-light));
+ color: #fff !important;
+ }
+
+ .disabled-btn {
+ background: #cccccc;
+ background-color: #cccccc !important;
+ color: #fff !important;
+ }
+
\ No newline at end of file
diff --git a/pages/goods/comment/add.vue b/pages/goods/comment/add.vue
index 0392516e..a0902194 100644
--- a/pages/goods/comment/add.vue
+++ b/pages/goods/comment/add.vue
@@ -1,157 +1,209 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
- {{ rateMap[state.commentList[index].level] }}
-
-
-
-
-
-
+
+
+
+
+
+ 商品质量
+
+
+
+
+
+
+ 服务态度
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+ .star-box {
+ height: 100rpx;
+ padding: 0 25rpx;
+ }
+
+ .star-title {
+ font-weight: 600;
+ }
+ }
+
+ .area-box {
+ width: 690rpx;
+ min-height: 306rpx;
+ background: rgba(249, 250, 251, 1);
+ border-radius: 20rpx;
+ padding: 28rpx;
+ margin: auto;
+
+ .img-box {
+ margin-top: 20rpx;
+ }
+ }
+
+ .post-btn {
+ width: 690rpx;
+ line-height: 80rpx;
+ border-radius: 40rpx;
+ color: rgba(#fff, 0.9);
+ margin-bottom: 20rpx;
+ }
+
\ No newline at end of file
diff --git a/pages/order/detail.vue b/pages/order/detail.vue
index 8a748f9f..c6b370fc 100644
--- a/pages/order/detail.vue
+++ b/pages/order/detail.vue
@@ -200,7 +200,7 @@
确认收货
评价晒单
+ @tap="onComment(state.orderInfo.id,state.orderInfo)">评价晒单
查看发票
@@ -389,12 +389,15 @@
}
// 评价
- function onComment(orderSN) {
+ function onComment(orderSN, orderId) {
+ console.log(orderId);
+ // return;
uni.$once('SELECT_INVOICE', (e) => {
state.invoiceInfo = e.invoiceInfo;
});
sheep.$router.go('/pages/goods/comment/add', {
orderSN,
+ orderId
});
}
async function getOrderDetail(id) {
@@ -410,7 +413,8 @@
console.log(res, '我的订单详情数据');
if (res.code === 0) {
let obj = {
- 10: ['待发货', '等待买家付款', ["apply_refund"]]
+ 10: ['待发货', '等待买家付款', ["apply_refund"]],
+ 30: ['待评价', '等待买家评价', ["express", "comment"]]
}
res.data.status_text = obj[res.data.status][0];
res.data.status_desc = obj[res.data.status][1];
diff --git a/pages/user/wallet/money.vue b/pages/user/wallet/money.vue
index 94903b84..3b6a9143 100644
--- a/pages/user/wallet/money.vue
+++ b/pages/user/wallet/money.vue
@@ -20,7 +20,7 @@
-
-
- 总收入¥{{ }}
- 总支出¥{{ }}
+
+
@@ -45,7 +45,8 @@
{{ item.title }}
- +{{ item.amount||item.price }}
+ +{{ item.amount||item.price }}
{{ item.price }}
@@ -133,7 +134,7 @@
income: res.data.income,
expense: res.data.expense,
};
- console.log('交易数据',state.pagination)
+ console.log('交易数据', state.pagination)
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
diff --git a/sheep/api/coupon.js b/sheep/api/coupon.js
index 4c4d21bc..3f5e8e6e 100644
--- a/sheep/api/coupon.js
+++ b/sheep/api/coupon.js
@@ -1,38 +1,45 @@
import request from '@/sheep/request';
+import request2 from '@/sheep/request2';
export default {
- // 我的拼团
- list: (params) =>
- request({
- url: 'coupon',
- method: 'GET',
- params,
- custom: {
- showLoading: false,
- },
- }),
- userCoupon: (params) =>
- request({
- url: 'user/coupon',
- method: 'GET',
- params,
- }),
- detail: (id, user_coupon_id) =>
- request({
- url: 'coupon/' + id,
- method: 'GET',
- params: {
- user_coupon_id,
- },
- }),
- get: (id) =>
- request({
- url: 'coupon/get/' + id,
- method: 'POST',
- }),
- listByGoods: (id) =>
- request({
- url: 'coupon/listByGoods/' + id,
- method: 'GET',
- }),
-};
+ // 我的拼团
+ list: (params) =>
+ request({
+ url: 'coupon',
+ method: 'GET',
+ params,
+ custom: {
+ showLoading: false,
+ },
+ }),
+ userCoupon: (params) =>
+ request2({
+ url: 'promotion/coupon/page',
+ method: 'GET',
+ params,
+ }),
+ // userCoupon: (params) =>
+ // request({
+ // url: 'user/coupon',
+ // method: 'GET',
+ // params,
+ // }),
+ detail: (id, user_coupon_id) =>
+ request({
+ url: 'coupon/' + id,
+ method: 'GET',
+ params: {
+ user_coupon_id,
+ },
+ }),
+ get: (id) =>
+ request({
+ url: 'coupon/get/' + id,
+ method: 'POST',
+ }),
+ listByGoods: (id) =>
+ request({
+ url: 'coupon/listByGoods/' + id,
+ method: 'GET',
+ }),
+};
\ No newline at end of file
diff --git a/sheep/api/order.js b/sheep/api/order.js
index 2aa1f5d7..ee6d9ea1 100644
--- a/sheep/api/order.js
+++ b/sheep/api/order.js
@@ -107,12 +107,18 @@ export default {
method: 'PUT',
}),
// 评价订单
- comment: (id, data) =>
- request({
- url: 'order/order/comment/' + id,
+ comment: (data) =>
+ request2({
+ url: 'trade/order/item/create-comment',
method: 'POST',
data,
}),
+ // comment: (id, data) =>
+ // request({
+ // url: 'order/order/comment/' + id,
+ // method: 'POST',
+ // data,
+ // }),
// 申请退款
applyRefund: (id) =>
request({
diff --git a/sheep/components/s-coupon-card/s-coupon-card.vue b/sheep/components/s-coupon-card/s-coupon-card.vue
index 2e0d2209..5be18c85 100644
--- a/sheep/components/s-coupon-card/s-coupon-card.vue
+++ b/sheep/components/s-coupon-card/s-coupon-card.vue
@@ -1,80 +1,78 @@
-
+
+ .ss-coupon-menu-wrap {
+ .menu-item {
+ height: 160rpx;
+
+ .menu-title {
+ font-size: 24rpx;
+ line-height: 24rpx;
+ color: #333333;
+ }
+
+ .item-icon {
+ width: 44rpx;
+ height: 44rpx;
+ }
+ }
+
+ .menu-wallet {
+ width: 144rpx;
+ }
+ }
+
\ No newline at end of file
diff --git a/sheep/components/s-coupon-list/s-coupon-list.vue b/sheep/components/s-coupon-list/s-coupon-list.vue
index b22ed98d..648b32da 100644
--- a/sheep/components/s-coupon-list/s-coupon-list.vue
+++ b/sheep/components/s-coupon-list/s-coupon-list.vue
@@ -1,192 +1,195 @@
-
-
-
+
+
+
+
+ {{ data.name }}
-
- {{ data.name }}
+
+
- ¥
- {{ data.amount }}
- 折
-
-
-
-
-
+ ¥
+ {{ data.amount }}
+ 折
+
+
+
+
+
- {{
+ ">
+ {{'有效期:' + data.use_start_time.substring(0, 11) }}至
+ {{ data.use_end_time.substring(0, 11) }}
+
+
+ 满{{ data.enough }}可用
-
-
-
+ ">满{{ data.enough }}可用
+
+
+
-
-
-
- {{ data.description }}
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {{ data.description }}
+
+
+
+
+
+
+
+
+
+
+
+ .info-color {
+ color: #333;
+ }
+
+ .subtitle-color {
+ color: #666;
+ }
+
+ .disabled-color {
+ color: #999;
+ }
+
+ .content {
+ width: 100%;
+ background: #fff;
+ border-radius: 20rpx 20rpx 0 0;
+ -webkit-mask: radial-gradient(circle at 12rpx 100%, #0000 12rpx, red 0) -12rpx;
+ box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
+
+ .tag {
+ width: 100rpx;
+
+ color: #fff;
+ height: 40rpx;
+ font-size: 24rpx;
+ border-radius: 20rpx 0 20rpx 0;
+ }
+
+ .title {
+ padding-bottom: 22rpx;
+ border-bottom: 2rpx dashed #d3d3d3;
+
+ .value-text {
+ font-size: 32rpx;
+ font-weight: 600;
+ }
+
+ .sellby-text {
+ font-size: 24rpx;
+ font-weight: 400;
+ }
+
+ .value-price {
+ font-size: 64rpx;
+ font-weight: 500;
+ line-height: normal;
+ font-family: OPPOSANS;
+ }
+
+ .value-reduce {
+ line-height: normal;
+ font-size: 32rpx;
+ }
+
+ .value-discount {
+ line-height: normal;
+ font-size: 28rpx;
+ }
+
+ .value-enough {
+ font-size: 24rpx;
+ font-weight: 400;
+ font-family: OPPOSANS;
+ }
+ }
+ }
+
+ .desc {
+ width: 100%;
+ background: #fff;
+ -webkit-mask: radial-gradient(circle at 12rpx 0%, #0000 12rpx, red 0) -12rpx;
+ box-shadow: rgba(#000, 0.1);
+ box-sizing: border-box;
+ padding: 24rpx 30rpx;
+ box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
+ border-radius: 0 0 20rpx 20rpx;
+
+ .desc-title {
+ font-size: 24rpx;
+ color: #999;
+ font-weight: 400;
+ }
+ }
+
+ .price-text {
+ color: #ff0000;
+ }
+
\ No newline at end of file
diff --git a/sheep/store/user.js b/sheep/store/user.js
index 0b329e79..b604f558 100644
--- a/sheep/store/user.js
+++ b/sheep/store/user.js
@@ -1,168 +1,190 @@
-import { defineStore } from 'pinia';
+import {
+ defineStore
+} from 'pinia';
import userApi from '@/sheep/api/user';
import commissionApi from '@/sheep/api/commission';
import $share from '@/sheep/platform/share';
-import { isEmpty, cloneDeep, clone } from 'lodash';
+import {
+ isEmpty,
+ cloneDeep,
+ clone
+} from 'lodash';
import cart from './cart';
import app from './app';
-import { showAuthModal } from '@/sheep/hooks/useModal';
+import {
+ showAuthModal
+} from '@/sheep/hooks/useModal';
// 默认用户信息
const defaultUserInfo = {
- avatar: '', // 头像
- nickname: '', // 昵称
- gender: 0, // 性别
- mobile: '', // 手机号
- money: '--', // 余额
- commission: '--', // 佣金
- score: '--', // 积分
- verification: {}, // 认证字段
+ avatar: '', // 头像
+ nickname: '', // 昵称
+ gender: 0, // 性别
+ mobile: '', // 手机号
+ money: '--', // 余额
+ commission: '--', // 佣金
+ score: '--', // 积分
+ verification: {}, // 认证字段
};
// 默认订单、优惠券等其他资产信息
const defaultNumData = {
- coupons_num: '--',
- order_num: {
- aftersale: 0,
- nocomment: 0,
- noget: 0,
- nosend: 0,
- unpaid: 0,
- },
+ coupons_num: '--',
+ order_num: {
+ aftersale: 0,
+ nocomment: 0,
+ noget: 0,
+ nosend: 0,
+ unpaid: 0,
+ },
};
const user = defineStore({
- id: 'user',
- state: () => ({
- userInfo: clone(defaultUserInfo), // 用户信息
- isLogin: !!uni.getStorageSync('token'), // 登录状态
- numData: cloneDeep(defaultNumData), // 用户其他数据
- agentInfo: {}, // 分销商信息
- lastUpdateTime: 0, // 上次更新时间
- }),
+ id: 'user',
+ state: () => ({
+ userInfo: clone(defaultUserInfo), // 用户信息
+ isLogin: !!uni.getStorageSync('token'), // 登录状态
+ numData: cloneDeep(defaultNumData), // 用户其他数据
+ agentInfo: {}, // 分销商信息
+ lastUpdateTime: 0, // 上次更新时间
+ }),
- actions: {
- // 获取个人信息
- async getInfo() {
- const { code, data } = await userApi.profile();
- // 为了兼容 获取用户余额 可能还会用到其他参数
- const { code:code2, data:data2 } = await userApi.balance();
- if (code !== 0||code2!=0) return;
- data.money=data2.balance/100;
- this.userInfo = data;
+ actions: {
+ // 获取个人信息
+ async getInfo() {
+ const {
+ code,
+ data
+ } = await userApi.profile();
+ // 为了兼容 获取用户余额 可能还会用到其他参数
+ // 优惠券数量,积分数量 应该在这里
+ const {
+ code: code2,
+ data: data2
+ } = await userApi.balance();
+ if (code !== 0 || code2 != 0) return;
+ data.money = data2.balance / 100;
+ this.userInfo = data;
+ console.log(data2, '信息')
+ return Promise.resolve(data);
+ },
- return Promise.resolve(data);
- },
+ // 获取分销商信息
+ async getAgentInfo() {
+ const res = await commissionApi.agent();
+ if (res.error === 0) {
+ this.agentInfo = res.data;
+ }
+ return Promise.resolve(res);
+ },
- // 获取分销商信息
- async getAgentInfo() {
- const res = await commissionApi.agent();
- if (res.error === 0) {
- this.agentInfo = res.data;
- }
- return Promise.resolve(res);
- },
+ // 获取订单、优惠券等其他资产信息
+ async getNumData() {
+ const {
+ code,
+ data
+ } = await userApi.data();
+ const data2 = await userApi.data2();
+ if (code === 0 && data2.code === 0) {
+ console.log('订单数据', data);
+ this.numData = {
+ order_num: {
+ noget: data.deliveredCount,
+ unpaid: data.unpaidCount,
+ nocomment: data.uncommentedCount,
+ aftersale: data2.data
+ }
+ };
+ }
+ },
- // 获取订单、优惠券等其他资产信息
- async getNumData() {
- const { code, data } = await userApi.data();
- const data2 = await userApi.data2();
- if (code === 0&&data2.code===0) {
- console.log('订单数据',data);
- this.numData = {order_num:{
- noget:data.deliveredCount,
- unpaid:data.unpaidCount,
- nocomment:data.uncommentedCount,
- aftersale:data2.data
- }};
- }
- },
+ // 添加分享记录
+ async addShareLog(params) {
+ const {
+ error
+ } = await userApi.addShareLog(params);
+ if (error === 0) uni.removeStorageSync('shareLog');
+ },
- // 添加分享记录
- async addShareLog(params) {
- const { error } = await userApi.addShareLog(params);
- if (error === 0) uni.removeStorageSync('shareLog');
- },
+ // 设置token
+ setToken(token = '') {
+ if (token === '') {
+ this.isLogin = false;
+ uni.removeStorageSync('token');
+ } else {
+ this.isLogin = true;
+ uni.setStorageSync('token', token);
+ this.loginAfter();
+ }
+ return this.isLogin;
+ },
- // 设置token
- setToken(token = '') {
- if (token === '') {
- this.isLogin = false;
- uni.removeStorageSync('token');
- } else {
- this.isLogin = true;
- uni.setStorageSync('token', token);
- this.loginAfter();
- }
- return this.isLogin;
- },
+ // 更新用户相关信息 (手动限流 5秒之内不刷新)
+ async updateUserData() {
+ if (!this.isLogin) {
+ this.resetUserData();
+ return;
+ }
+ const nowTime = new Date().getTime();
+ if (this.lastUpdateTime + 5000 > nowTime) return;
+ await this.getInfo();
+ this.getNumData();
+ this.lastUpdateTime = nowTime;
+ return this.userInfo;
+ },
- // 更新用户相关信息 (手动限流 5秒之内不刷新)
- async updateUserData() {
- if (!this.isLogin) {
- this.resetUserData();
- return;
- }
- const nowTime = new Date().getTime();
- if (this.lastUpdateTime + 5000 > nowTime) return;
- await this.getInfo();
- this.getNumData();
- this.lastUpdateTime = nowTime;
- return this.userInfo;
- },
+ // 重置用户默认数据
+ resetUserData() {
+ this.setToken();
+ this.userInfo = clone(defaultUserInfo);
+ this.numData = cloneDeep(defaultNumData);
+ this.agentInfo = {};
+ cart().emptyList();
+ },
- // 重置用户默认数据
- resetUserData() {
- this.setToken();
- this.userInfo = clone(defaultUserInfo);
- this.numData = cloneDeep(defaultNumData);
- this.agentInfo = {};
- cart().emptyList();
- },
+ // 登录后
+ async loginAfter() {
+ await this.updateUserData();
+ cart().getList();
+ // 登录后设置全局分享参数
+ $share.getShareInfo();
+ // 提醒绑定手机号
+ if (app().platform.bind_mobile && !this.userInfo.verification?.mobile) {
+ showAuthModal('changeMobile');
+ }
- // 登录后
- async loginAfter() {
- await this.updateUserData();
- cart().getList();
- // 登录后设置全局分享参数
- $share.getShareInfo();
- // 提醒绑定手机号
- if (app().platform.bind_mobile && !this.userInfo.verification?.mobile) {
- showAuthModal('changeMobile');
- }
+ // 添加分享记录
+ const shareLog = uni.getStorageSync('shareLog');
+ if (!isEmpty(shareLog)) {
+ this.addShareLog({
+ ...shareLog,
+ });
+ }
+ },
- // 添加分享记录
- const shareLog = uni.getStorageSync('shareLog');
- if (!isEmpty(shareLog)) {
- this.addShareLog({
- ...shareLog,
- });
- }
- },
+ // 登出
+ async logout(force = false) {
+ if (!force) {
+ const {
+ error
+ } = await userApi.logout();
+ if (error === 0) {
+ this.resetUserData();
+ }
+ }
+ if (force) {
+ this.resetUserData();
+ }
- // 登出
- async logout(force = false) {
- if (!force) {
- const { error } = await userApi.logout();
- if (error === 0) {
- this.resetUserData();
- }
- }
- if (force) {
- this.resetUserData();
- }
-
- return !this.isLogin;
- },
- },
- persist: {
- enabled: true,
- strategies: [
- {
- key: 'user-store',
- },
- ],
- },
+ return !this.isLogin;
+ },
+ },
+ persist: {
+ enabled: true,
+ strategies: [{
+ key: 'user-store',
+ }, ],
+ },
});
-export default user;
+export default user;
\ No newline at end of file