Browse Source

预下单

dev_des
1054425342@qq.com 1 month ago
parent
commit
42149b1d87
  1. 23
      package-lock.json
  2. 3
      package.json
  3. 15
      static/js/request.js
  4. 123
      subPackages/points/index.vue
  5. 23
      subPackages/techan/detail.vue
  6. 1278
      subPackages/techan/order - 副本.vue
  7. 1507
      subPackages/techan/order.vue
  8. 3
      subPackages/user/gwc.vue

23
package-lock.json

@ -9,10 +9,21 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"decimal.js": "^10.6.0",
"js-md5": "^0.8.3",
"moment": "^2.30.1", "moment": "^2.30.1",
"ydui-district": "^1.1.0" "ydui-district": "^1.1.0"
}
},
"node_modules/decimal.js": {
"version": "10.6.0",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
"integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg=="
}, },
"devDependencies": {} "node_modules/js-md5": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.8.3.tgz",
"integrity": "sha512-qR0HB5uP6wCuRMrWPTrkMaev7MJZwJuuw4fnwAzRgP4J4/F8RwtodOKpGp4XpqsLBFzzgqIO42efFAyz2Et6KQ=="
}, },
"node_modules/moment": { "node_modules/moment": {
"version": "2.30.1", "version": "2.30.1",
@ -29,6 +40,16 @@
} }
}, },
"dependencies": { "dependencies": {
"decimal.js": {
"version": "10.6.0",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
"integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg=="
},
"js-md5": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.8.3.tgz",
"integrity": "sha512-qR0HB5uP6wCuRMrWPTrkMaev7MJZwJuuw4fnwAzRgP4J4/F8RwtodOKpGp4XpqsLBFzzgqIO42efFAyz2Et6KQ=="
},
"moment": { "moment": {
"version": "2.30.1", "version": "2.30.1",
"resolved": "https://registry.npmmirror.com/moment/-/moment-2.30.1.tgz", "resolved": "https://registry.npmmirror.com/moment/-/moment-2.30.1.tgz",

3
package.json

@ -4,10 +4,11 @@
"description": "", "description": "",
"main": "main.js", "main": "main.js",
"dependencies": { "dependencies": {
"decimal.js": "^10.6.0",
"js-md5": "^0.8.3",
"moment": "^2.30.1", "moment": "^2.30.1",
"ydui-district": "^1.1.0" "ydui-district": "^1.1.0"
}, },
"devDependencies": {},
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },

15
static/js/request.js

@ -1,6 +1,6 @@
import Vue from 'vue'; import Vue from 'vue';
import store from '@/store'; import store from '@/store';
import md5 from 'js-md5';
// 定义 API URL // 定义 API URL
const DEV_API_URL = 'http://1.13.193.49'; const DEV_API_URL = 'http://1.13.193.49';
// const DEV_API_URL = 'https://epic.js-dyyj.com'; // const DEV_API_URL = 'https://epic.js-dyyj.com';
@ -81,6 +81,16 @@ Vue.prototype.Post = (params = {}, apiurl,customUrl) => {
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
}); });
let userID = ''
const userInfoFromStorage = uni.getStorageSync('userInfo');
if (userInfoFromStorage) {
const userInfo = JSON.parse(userInfoFromStorage);
if (userInfo.id) {
userID = userInfo.id.toString();
}
}
let time = new Date().getTime()
let sign = userID+ time
uni.request({ uni.request({
method: params.method || 'GET', method: params.method || 'GET',
url:baseUrl + apiurl, url:baseUrl + apiurl,
@ -89,9 +99,10 @@ Vue.prototype.Post = (params = {}, apiurl,customUrl) => {
'content-type': 'application/json', 'content-type': 'application/json',
'token': token || '', 'token': token || '',
'userId': getUserId() || '', 'userId': getUserId() || '',
'sign':md5(md5(sign.toString())),
'timestamp':time
}, },
success: (res) => { success: (res) => {
console.log('success', res.data);
uni.hideLoading() uni.hideLoading()
if (res.data.code === 200 || res.data.code === 1) { if (res.data.code === 200 || res.data.code === 1) {
resolve(res.data); resolve(res.data);

123
subPackages/points/index.vue

@ -9,21 +9,38 @@
<!-- 时间奖励值 --> <!-- 时间奖励值 -->
<view class="time-reward" @click="showExchangeModal"> <view class="time-reward" @click="showExchangeModal">
<view class="reward-icon"> <view class="reward-icon">
<nmr-icon name="jifenduihuan" style="margin-right: 10rpx;margin-top: 3rpx;" size="40" <nmr-icon
color="white"></nmr-icon> name="jifenduihuan"
style="margin-right: 10rpx; margin-top: 3rpx"
size="40"
color="white"
></nmr-icon
>兑换奖励
</view> </view>
</view> </view>
</view> </view>
<!-- 筛选选项 --> <!-- 筛选选项 -->
<view class="filter-tabs"> <view class="filter-tabs">
<view class="tab-item" :class="[{ active: currentTab === 'all' }]" @click="switchTab('all')"> <view
class="tab-item"
:class="[{ active: currentTab === 'all' }]"
@click="switchTab('all')"
>
全部 全部
</view> </view>
<view class="tab-item" :class="[{ active: currentTab === 'in' }]" @click="switchTab('in')"> <view
class="tab-item"
:class="[{ active: currentTab === 'in' }]"
@click="switchTab('in')"
>
收入 收入
</view> </view>
<view class="tab-item" :class="[{ active: currentTab === 'out' }]" @click="switchTab('out')"> <view
class="tab-item"
:class="[{ active: currentTab === 'out' }]"
@click="switchTab('out')"
>
支出 支出
</view> </view>
</view> </view>
@ -31,9 +48,16 @@
<!-- 积分记录列表 --> <!-- 积分记录列表 -->
<scroll-view class="points-list" scroll-y="true" @scrolltolower="loadMore"> <scroll-view class="points-list" scroll-y="true" @scrolltolower="loadMore">
<template v-if="pointsList.length"> <template v-if="pointsList.length">
<view class="record-item" v-for="(item, index) in pointsList" :key="index"> <view
class="record-item"
v-for="(item, index) in pointsList"
:key="index"
>
<view class="record-left"> <view class="record-left">
<view class="record-icon" :class="item.fromType === 'in' ? 'income' : 'expense'"> <view
class="record-icon"
:class="item.fromType === 'in' ? 'income' : 'expense'"
>
<nmr-icon name="jifen" size="60" color="#333"></nmr-icon> <nmr-icon name="jifen" size="60" color="#333"></nmr-icon>
</view> </view>
<view class="record-info"> <view class="record-info">
@ -43,7 +67,10 @@
</view> </view>
</view> </view>
<view class="record-right"> <view class="record-right">
<view class="record-points" :class="item.fromType === 'in' ? 'income' : 'expense'"> <view
class="record-points"
:class="item.fromType === 'in' ? 'income' : 'expense'"
>
{{ item.points }} {{ item.points }}
</view> </view>
</view> </view>
@ -64,9 +91,11 @@
<!-- 空状态 --> <!-- 空状态 -->
<view class="empty-state" v-if="pointsList.length === 0 && !loading"> <view class="empty-state" v-if="pointsList.length === 0 && !loading">
<image class="empty-icon" <image
class="empty-icon"
src="https://epic.js-dyyj.com/uploads/20250808/c16267f9cc2b7a68bf23713b5847987e.png" src="https://epic.js-dyyj.com/uploads/20250808/c16267f9cc2b7a68bf23713b5847987e.png"
mode="aspectFit"></image> mode="aspectFit"
></image>
<text class="empty-text">暂无积分记录</text> <text class="empty-text">暂无积分记录</text>
</view> </view>
</scroll-view> </scroll-view>
@ -84,21 +113,29 @@
<view class="modal-content"> <view class="modal-content">
<view class="current-reward"> <view class="current-reward">
<text class="reward-label">当前时间奖励值</text> <text class="reward-label">当前时间奖励值</text>
<text class="reward-value">{{ userInfo&&userInfo.hourValue||0 }}</text> <text class="reward-value">{{
(userInfo && userInfo.hourValue) || 0
}}</text>
</view> </view>
<view class="exchange-form"> <view class="exchange-form">
<view class="form-item"> <view class="form-item">
<text class="form-label">兑换数量</text> <text class="form-label">兑换数量</text>
<input class="form-input" v-model="exchangeAmount" type="number" placeholder="请输入兑换数量" /> <input
class="form-input"
v-model="exchangeAmount"
type="number"
placeholder="请输入兑换数量"
/>
</view> </view>
</view> </view>
<view class="exchange-rules"> <view class="exchange-rules">
<text class="rules-title">兑换规则</text> <text class="rules-title">兑换规则</text>
<view class="rules-list"> <view class="rules-list">
<text class="rule-item"> 1个时间奖励值 = {{pointInfo.points||0}}积分</text> <text class="rule-item"
> 1个时间奖励值 = {{ pointInfo.points || 0 }}积分</text
>
</view> </view>
</view> </view>
</view> </view>
@ -126,14 +163,12 @@
refreshing: false, refreshing: false,
userInfo: null, userInfo: null,
timeReward: 0, timeReward: 0,
exchangeAmount: '', exchangeAmount: "",
exchangeResult: 0, exchangeResult: 0,
pointInfo: null pointInfo: null,
}; };
}, },
onLoad() { onLoad() {
this.getUserInfo(); this.getUserInfo();
this.loadPointsData(); this.loadPointsData();
@ -142,12 +177,12 @@
methods: { methods: {
getUserInfo() { getUserInfo() {
this.Post({}, "/framework/user/getInfo", "DES").then((res) => { this.Post({}, "/framework/user/getInfo", "DES").then((res) => {
this.userInfo = this.userInfo =
(uni.getStorageSync("userInfo") && (uni.getStorageSync("userInfo") &&
JSON.parse(uni.getStorageSync("userInfo"))) || JSON.parse(uni.getStorageSync("userInfo"))) ||
this.$store.state.user.userInfo || {}; this.$store.state.user.userInfo ||
{};
res.data.token = this.userInfo.token; res.data.token = this.userInfo.token;
uni.setStorageSync("userInfo", JSON.stringify(res.data)); uni.setStorageSync("userInfo", JSON.stringify(res.data));
this.userInfo = res.data; this.userInfo = res.data;
@ -176,13 +211,12 @@
// //
async getTotalPoints() { async getTotalPoints() {
try { try {
this.Post({}, '/framework/points/getLastBalance', 'DES').then(res => { this.Post({}, "/framework/points/getLastBalance", "DES").then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.pointInfo = res.data this.pointInfo = res.data;
this.totalPoints = res.data.balance || 0; this.totalPoints = res.data.balance || 0;
} }
}) });
} catch (error) { } catch (error) {
console.error("获取总积分失败:", error); console.error("获取总积分失败:", error);
} }
@ -204,9 +238,8 @@
params.fromType = this.currentTab; params.fromType = this.currentTab;
} }
this.Post(params, '/framework/points/list', 'DES') this.Post(params, "/framework/points/list", "DES").then((res) => {
.then(res => { console.log(res);
console.log(res)
if (res.code === 200) { if (res.code === 200) {
const newData = res.rows || []; const newData = res.rows || [];
@ -227,9 +260,7 @@
icon: "none", icon: "none",
}); });
} }
}) });
} catch (error) { } catch (error) {
console.error("加载积分记录失败:", error); console.error("加载积分记录失败:", error);
uni.showToast({ uni.showToast({
@ -257,10 +288,6 @@
this.getTotalPoints(); this.getTotalPoints();
}, },
// //
showExchangeModal() { showExchangeModal() {
this.$refs.exchangePopup.open(); this.$refs.exchangePopup.open();
@ -269,27 +296,27 @@
// //
closeExchangeModal() { closeExchangeModal() {
this.$refs.exchangePopup.close(); this.$refs.exchangePopup.close();
this.exchangeAmount = ''; this.exchangeAmount = "";
this.exchangeResult = 0; this.exchangeResult = 0;
}, },
async confirmExchange() { async confirmExchange() {
if (parseInt(this.exchangeAmount) > this.userInfo.hourValue) { if (parseInt(this.exchangeAmount) > this.userInfo.hourValue) {
uni.showToast({ uni.showToast({
title: '兑换值大于可用值', title: "兑换值大于可用值",
icon: 'none' icon: "none",
}) });
return return;
} }
try { try {
const params = { const params = {
hour: parseInt(this.exchangeAmount), hour: parseInt(this.exchangeAmount),
method: 'post' method: "post",
}; };
this.Post(params, '/framework/points/hourChange', 'DES').then(res => { this.Post(params, "/framework/points/hourChange", "DES").then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: '兑换成功', title: "兑换成功",
icon: 'success' icon: "success",
}); });
// //
@ -300,16 +327,16 @@
this.closeExchangeModal(); this.closeExchangeModal();
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg || '兑换失败', title: res.msg || "兑换失败",
icon: 'none' icon: "none",
}); });
} }
}); });
} catch (error) { } catch (error) {
console.error('兑换失败:', error); console.error("兑换失败:", error);
uni.showToast({ uni.showToast({
title: '网络错误,请重试', title: "网络错误,请重试",
icon: 'none' icon: "none",
}); });
} }
}, },

23
subPackages/techan/detail.vue

@ -288,22 +288,17 @@
} }
}, },
order(item) { order() {
let goods = this.sku[this.productIndex] let goods = this.sku[this.productIndex]
goods.buyNum = this.buyNum goods.buyNum = this.buyNum
let list = [{
let orderInfo = { ...goods,
// is_post: goods.is_post || "2", specUrl:goods.imageUrl,
is_post: 1, goodsName:this.info.goodsName,
goods: [{goodsInfo: this.info, skuInfo: goods }], quantity:goods.buyNum
post: 0, }]
} this.$store.commit("changeOrderSCart", list);
this.gotoPath("/subPackages/techan/order");
uni.setStorageSync('teChanOrder', JSON.stringify(orderInfo)); //
// uni.setStorageSync('teChanInfo', JSON.stringify(this.info)); //
uni.navigateTo({
url: '/subPackages/techan/order'
});
}, },
addToCart () { addToCart () {
let goods = this.sku[this.productIndex] let goods = this.sku[this.productIndex]

1278
subPackages/techan/order - 副本.vue

File diff suppressed because it is too large

1507
subPackages/techan/order.vue

File diff suppressed because it is too large

3
subPackages/user/gwc.vue

@ -374,7 +374,8 @@
.then((res) => { .then((res) => {
if (res.data.canOrder) { if (res.data.canOrder) {
this.$store.commit("changeOrderSCart", list); this.$store.commit("changeOrderSCart", list);
this.gotoPath("/subPackages/order/gwcOrder"); this.gotoPath("/subPackages/techan/order");
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,

Loading…
Cancel
Save