diff --git a/common/api/market/birthdayGift.js b/common/api/market/birthdayGift.js new file mode 100644 index 0000000..96b3a8e --- /dev/null +++ b/common/api/market/birthdayGift.js @@ -0,0 +1,11 @@ +// 引入 request 文件 +import request from "@/common/api/request.js"; +import { prveUrl } from "./config.js"; + +export const config = (data) => { + return request({ + url: prveUrl + "/user/birthdayGift", + method: "get", + data: data, + }); +}; diff --git a/common/api/market/discountActivity.js b/common/api/market/discountActivity.js new file mode 100644 index 0000000..443b867 --- /dev/null +++ b/common/api/market/discountActivity.js @@ -0,0 +1,11 @@ +// 引入 request 文件 +import request from "@/common/api/request.js"; +import { prveUrl } from "./config.js"; + +export const config = (data) => { + return request({ + url: prveUrl + "/user/discountActivity", + method: "get", + data: data, + }); +}; diff --git a/common/api/market/distribution.js b/common/api/market/distribution.js new file mode 100644 index 0000000..7ad74cc --- /dev/null +++ b/common/api/market/distribution.js @@ -0,0 +1,149 @@ +// 引入 request 文件 +import request from "@/common/api/request.js"; +import { prveUrl } from "./config.js"; + +export const pay = (data) => { + let platformType = ""; + let payType = ""; + // #ifdef APP-PLUS + platformType = "APP"; + // #endif + // #ifdef H5 + platformType = "H5"; + // #endif + // #ifdef MP-WEIXIN + platformType = "WX"; + platformType = "wechat"; + payType = "wechatPay"; + // #endif + // #ifdef MP-ALIPAY + platformType = "alipay"; + payType = "aliPay"; + // #endif + + + return request({ + url: prveUrl + "/user/distribution/pay", + method: "post", + data: { platformType, payType, ...data }, + }); +}; + +export const centerUser = (data) => { + return request({ + url: prveUrl + "/user/distribution/centerUser", + method: "post", + data: data, + }); +}; +export const activates = (data) => { + return request({ + url: prveUrl + "/user/distribution/centerUser/activates", + method: "get", + data: data, + }); +}; +export const unActivates = (data) => { + return request({ + url: prveUrl + "/user/distribution/centerUser/unActivates", + method: "get", + data: data, + }); +}; +export const centerConfig = (data) => { + return request({ + url: prveUrl + "/user/distribution/centerConfig", + method: "get", + data: data, + }); +}; + + +// 绑定邀请用户 +export const bindInviteUser = (data) => { + return request({ + url: prveUrl + "/user/distribution/bindInviteUser", + method: "post", + data: data, + }); +}; + +export const childUser = (data) => { + return request({ + url: prveUrl + "/user/distribution/childUser", + method: "get", + data: data, + }); +}; +export const inviteUser = (data) => { + return request({ + url: prveUrl + "/user/distribution/inviteUser", + method: "get", + data: data, + }); +}; + +// 提现 +export const withdraw = (data) => { + return request({ + url: prveUrl + "/user/distribution/withdraw", + method: "post", + data: data, + }); +}; + +// 提现详情 +export const withdrawDetail = (data) => { + return request({ + url: prveUrl + "/user/distribution/withdraw/detail", + method: "get", + data: data, + }); +}; +//提现记录 +export const withdrawFlow = (data) => { + return request({ + url: prveUrl + "/user/distribution/withdraw/flow", + method: "get", + data: data, + }); +}; + +// 实名认证 +export const realNameAuth = (data) => { + return request({ + url: prveUrl + "/user/distribution/realNameAuth", + method: "post", + data: data, + }); +}; + + +// 收益明细 +export const getIncomeDetails = (data) => { + return request({ + url: prveUrl + "/user/distribution/distributionFlow", + method: "get", + data: data, + }); +}; + +// 获取邀请码 +export const getInviteCode = (data) => { + return request({ + url: prveUrl + "/user/distribution/getInviteCode", + method: "get", + data: data, + }); +}; + +// 获取配置 +export const getConfig = (data) => { + return request({ + url: prveUrl + "/user/distribution/getConfig", + method: "get", + data: data, + }); +}; + + diff --git a/common/api/market/drainageConfig.js b/common/api/market/drainageConfig.js new file mode 100644 index 0000000..c25d08a --- /dev/null +++ b/common/api/market/drainageConfig.js @@ -0,0 +1,11 @@ +// 引入 request 文件 +import request from "@/common/api/request.js"; +import { prveUrl } from "./config.js"; + +export const config = (data) => { + return request({ + url: prveUrl + "/user/drainageConfig", + method: "get", + data: data, + }); +}; diff --git a/common/api/market/exchange.js b/common/api/market/exchange.js new file mode 100644 index 0000000..5ec7b26 --- /dev/null +++ b/common/api/market/exchange.js @@ -0,0 +1,18 @@ +// 引入 request 文件 +import request from '@/common/api/request.js' +import {prveUrl} from './config.js' + +export const exchange = (data) => { + return request({ + url: prveUrl + '/user/redemption/exchange', + method: 'post', + data: data + }) +} +export const redemption = (data) => { + return request({ + url: prveUrl + '/user/redemption', + method: 'get', + data: data + }) +} diff --git a/common/api/market/limitTimeDiscount.js b/common/api/market/limitTimeDiscount.js new file mode 100644 index 0000000..9d861d0 --- /dev/null +++ b/common/api/market/limitTimeDiscount.js @@ -0,0 +1,11 @@ +// 引入 request 文件 +import request from '@/common/api/request.js' +import {prveUrl} from './config.js' + +export const getConfig = (data) => { + return request({ + url: prveUrl + '/user/limitTimeDiscount', + method: 'get', + data: data + }) +} diff --git a/common/api/market/suggest.js b/common/api/market/suggest.js new file mode 100644 index 0000000..a478c40 --- /dev/null +++ b/common/api/market/suggest.js @@ -0,0 +1,11 @@ +// 引入 request 文件 +import request from '@/common/api/request.js' +import {prveUrl} from './config.js' + +export const getGoods = (data) => { + return request({ + url: prveUrl + '/user/suggest', + method: 'get', + data: data + }) +} diff --git a/common/api/order/index.js b/common/api/order/index.js index 173a445..a500f17 100644 --- a/common/api/order/index.js +++ b/common/api/order/index.js @@ -135,4 +135,18 @@ export const rechargePayOrder = (data) => { ...data } }) -} \ No newline at end of file +} + +//分销员支付订单 +export const distributionLtPayOrder = (data) => { + return request({ + url: url + '/pay/distribution/ltPayOrder', + method: 'post', + data: { + platformType, + payType, + openId: uni.cache.get('userInfo').wechatOpenId, + ...data + } + }) +} diff --git a/common/api/request.js b/common/api/request.js index 6e62009..adda8b2 100644 --- a/common/api/request.js +++ b/common/api/request.js @@ -1,120 +1,138 @@ export default (params) => { - let url = params.url; - let method = params.method || "get"; - let data = params.data || {}; - let type = params.type || 1; - let toast = params.toast || true; - let token=uni.cache.get('token') || ''; - const shopId=uni.cache.get('shopId')*1; - const userInfo=uni.cache.get('userInfo')||{}; - // #ifdef H5 - token="21f0a0b10e1d40ce9c6464037fedb792" - // #endif - let header = { - version: uni.conf.version, - type: uni.getSystemInfoSync().platform, - // #ifdef APP-PLUS - platformType: 'APP', - // #endif - // #ifdef H5 - platformType: 'H5', - // #endif - // #ifdef MP-WEIXIN - platformType: 'WX', - // #endif - // #ifdef MP-ALIPAY - platformType: 'ALI', - // #endif - token, - id: userInfo.id || '', - shopId:shopId || '', - userId: userInfo.id || '', - } - if (toast) { - uni.showLoading({ - title: '加载中', - mask: true - }) - } - return new Promise((resolve, reject) => { - const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒 - uni.request({ - url: uni.conf.baseUrl + url, - method: method, - header: header, - data: data, - timeout: timeoutDuration, - success(response) { - const res = response.data - // 根据返回的状态码做出对应的操作 - //获取成功 - if (res.code == 200) { - uni.hideLoading(); - uni.hideToast(); - resolve(res.data ? res.data : true); - } else { - switch (res.code) { - case '501': - uni.cache.remove('shopId') - // uni.showToast({ - // title: '', - // icon: "none", - // success: () => { + let url = params.url; + let method = params.method || "get"; + let data = params.data || {}; + let type = params.type || 1; + let toast = params.toast || true; + let token = uni.cache.get("token") || ""; + const shopId = uni.cache.get("shopId") * 1; + const userInfo = uni.cache.get("userInfo") || {}; + // #ifdef H5 + token = "21f0a0b10e1d40ce9c6464037fedb792"; + // #endif + let header = { + version: uni.conf.version, + type: uni.getSystemInfoSync().platform, + // #ifdef APP-PLUS + platformType: "APP", + // #endif + // #ifdef H5 + platformType: "H5", + // #endif + // #ifdef MP-WEIXIN + platformType: "WX", + // #endif + // #ifdef MP-ALIPAY + platformType: "ALI", + // #endif + token, + id: userInfo.id || "", + shopId: shopId || "", + userId: userInfo.id || "", + }; + if (toast) { + uni.showLoading({ + title: "加载中", + mask: true, + }); + } + return new Promise((resolve, reject) => { + const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒 + uni.request({ + url: uni.conf.baseUrl + url, + method: method, + header: header, + data: data, + timeout: timeoutDuration, + success(response) { + const res = response.data; + // 根据返回的状态码做出对应的操作 + //获取成功 + if (res.code == 200) { + uni.hideLoading(); + uni.hideToast(); + resolve(res.data ? res.data : true); + } else { + switch (res.code) { + case "501": + uni.cache.remove("shopId"); + // uni.showToast({ + // title: '', + // icon: "none", + // success: () => { - // } - // }) - setTimeout(() => { - uni.reLaunch({ - url: "/pages/index/index", - }) - }, 1000); - break; - case 404: - uni.showToast({ - title: '请求地址不存在...', - duration: 2000, - }) - break; - default: - // 是否提示 - if (toast) { - uni.showToast({ - title: res.message || res.msg || res.error, - icon: "none", - success: () => { - setTimeout(res => { - reject(false); - }, 1000) - } - }) - } - break; - } - } - }, - fail(err) { - if (err.errMsg.indexOf('request:fail') !== -1) { - if (err.errMsg.indexOf('timeout') !== -1) { - if (toast) { - uni.showToast({ - title: `请求超时,请稍后重试`, - icon: "error", - duration: 2000 - }); - } - } - } - reject(err); - }, - complete() { - // 不管成功还是失败都会执行 - setTimeout(res => { - uni.hideLoading(); - uni.hideToast(); - }, 10000) - - } - }); - }).catch((e) => { - }); -}; \ No newline at end of file + // } + // }) + setTimeout(() => { + uni.reLaunch({ + url: "/pages/index/index", + }); + }, 1000); + break; + case 404: + uni.showToast({ + title: "请求地址不存在...", + duration: 2000, + }); + break; + default: + // 是否提示 + if (toast) { + uni.showToast({ + title: (() => { + // 1. 获取原始提示文本(兜底空字符串避免报错) + const originMsg = res.message || res.msg || res.error || ""; + // 2. 定义要匹配的前缀 + const exceptionPrefix = "Exception:"; + // 3. 判断是否包含目标前缀 + if (originMsg.includes(exceptionPrefix)) { + // 截取前缀后的内容 → 去除首尾空格 → 限制最大20个字符 + return originMsg + .slice( + originMsg.indexOf(exceptionPrefix) + + exceptionPrefix.length + ) + .trim() + .slice(0, 20); + } else { + // 不包含则按原逻辑截取前20个字符 + return originMsg.slice(0, 20); + } + })(), + icon: "none", + success: () => { + // 修复:去掉多余的 res 参数(避免覆盖外层 res) + setTimeout(() => { + reject(false); + }, 1000); + }, + }); + } + break; + } + } + }, + fail(err) { + if (err.errMsg.indexOf("request:fail") !== -1) { + if (err.errMsg.indexOf("timeout") !== -1) { + if (toast) { + uni.showToast({ + title: `请求超时,请稍后重试`, + icon: "error", + duration: 2000, + }); + } + } + } + reject(err); + }, + complete() { + // 不管成功还是失败都会执行 + setTimeout((res) => { + uni.hideLoading(); + uni.hideToast(); + }, 10000); + }, + }); + }).catch((e) => {}); +}; diff --git a/common/config.js b/common/config.js new file mode 100644 index 0000000..7c72342 --- /dev/null +++ b/common/config.js @@ -0,0 +1,54 @@ +// const debug = process.env.NODE_ENV == 'development' ? true : false; +const debug = true; +// #ifdef H5 +const proxyApi = "/api"; +// #endif + +// #ifdef MP-WEIXIN || APP || MP-ALIPAY +const proxyApi = "http://192.168.1.42"; // 调试地址 +const proxyApiwws = "ws://192.168.1.42:2348"; // 调试地址 +// #endif + +// #ifdef H5 +const baseUrl = debug ? proxyApi : "http://192.168.1.42"; +const baseUrlwws = "ws://192.168.1.42:2348"; +// #endif + +// #ifdef APP || MP-WEIXIN || MP-ALIPAY +const baseUrl = debug ? proxyApi : "https://cashier.sxczgkj.com"; // 线上 +const baseUrlwws = debug ? proxyApiwws : "wss://czgeatws.sxczgkj.com/wss"; // 线上 +// #endif + +const version = "100"; +const autoRemoveCache = { + count: 100000, + size: 100000, +}; + uni.conf = { + debug, + baseUrl, + version, + autoRemoveCache, + baseUrlwws, +}; + +export const changeEnv = (env) => { + if (env === "test") { + uni.conf = { + debug: true, + baseUrl: "http://192.168.1.42", + version: 100, + autoRemoveCache, + baseUrlwws: "ws://192.168.1.42:2348", + }; + } + if (env === "prod") { + uni.conf = { + debug: false, + baseUrl: "https://cashier.sxczgkj.com", + version: 100, + autoRemoveCache, + baseUrlwws: "wss://czgeatws.sxczgkj.com/wss", + }; + } +}; diff --git a/common/css/common.scss b/common/css/common.scss index 349114d..eee4645 100644 --- a/common/css/common.scss +++ b/common/css/common.scss @@ -74,6 +74,9 @@ page, .font-700{ font-weight: 700; } + .font-bold{ + font-weight: 700; + } .font-14{ font-size: 14px; } @@ -94,4 +97,22 @@ page, } .u-col-center{ align-items: center; + } + .justify-between{ + justify-content: space-between; + } + .justify-center{ + justify-content: center; + } + .u-flex-col{ + flex-direction: column!important; + } + .min-h-100vh{ + min-height: 100vh; + } + .bg-gray{ + background-color: #F7F7F7; + } + .align-center{ + align-items: center; } \ No newline at end of file diff --git a/components/birthday-modal.vue b/components/birthday-modal.vue new file mode 100644 index 0000000..0d8d86b --- /dev/null +++ b/components/birthday-modal.vue @@ -0,0 +1,545 @@ + + + + + \ No newline at end of file diff --git a/components/coupon-modal.vue b/components/coupon-modal.vue index 987b94e..c290f44 100644 --- a/components/coupon-modal.vue +++ b/components/coupon-modal.vue @@ -1,6 +1,6 @@