diff --git a/package-lock.json b/package-lock.json index 53483a8..55b9fab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,10 +9,21 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "decimal.js": "^10.6.0", + "js-md5": "^0.8.3", "moment": "^2.30.1", "ydui-district": "^1.1.0" - }, - "devDependencies": {} + } + }, + "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==" + }, + "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": { "version": "2.30.1", @@ -29,6 +40,16 @@ } }, "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": { "version": "2.30.1", "resolved": "https://registry.npmmirror.com/moment/-/moment-2.30.1.tgz", diff --git a/package.json b/package.json index 8d1b0c0..b464371 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,11 @@ "description": "", "main": "main.js", "dependencies": { + "decimal.js": "^10.6.0", + "js-md5": "^0.8.3", "moment": "^2.30.1", "ydui-district": "^1.1.0" }, - "devDependencies": {}, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, diff --git a/static/js/request.js b/static/js/request.js index f885069..a8bfb5d 100644 --- a/static/js/request.js +++ b/static/js/request.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import store from '@/store'; - +import md5 from 'js-md5'; // 定义 API URL const DEV_API_URL = 'http://1.13.193.49'; // const DEV_API_URL = 'https://epic.js-dyyj.com'; @@ -81,6 +81,16 @@ Vue.prototype.Post = (params = {}, apiurl,customUrl) => { uni.showLoading({ 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({ method: params.method || 'GET', url:baseUrl + apiurl, @@ -89,9 +99,10 @@ Vue.prototype.Post = (params = {}, apiurl,customUrl) => { 'content-type': 'application/json', 'token': token || '', 'userId': getUserId() || '', + 'sign':md5(md5(sign.toString())), + 'timestamp':time }, success: (res) => { - console.log('success', res.data); uni.hideLoading() if (res.data.code === 200 || res.data.code === 1) { resolve(res.data); diff --git a/subPackages/points/index.vue b/subPackages/points/index.vue index 3136fa5..37daba0 100644 --- a/subPackages/points/index.vue +++ b/subPackages/points/index.vue @@ -1,748 +1,775 @@ - - - - - {{ totalPoints }} - 当前积分 - - - - - 兑换奖励 - - - - - - - - 全部 - - - 收入 - - - 支出 - - - - - - - - - - - - - {{ item.dictName }} - {{ item.remark }} - {{ item.createTime }} - - - - - {{ item.points }} - - - - - - - {{ - loading ? "加载中..." : "上拉加载更多" - }} - - - - - 没有更多数据了 - - - - - - - 暂无积分记录 - - - - - - - - 时间奖励兑换 - - - - - - - - 当前时间奖励值: - {{ userInfo&&userInfo.hourValue||0 }} - - - - - 兑换数量: - - - - - - 兑换规则: - - • 1个时间奖励值 = {{pointInfo.points||0}}积分 - - - - - - - 取消 - 确认兑换 - - - - + + + + + {{ totalPoints }} + 当前积分 + + + + + 兑换奖励 + + + + + + + + 全部 + + + 收入 + + + 支出 + + + + + + + + + + + + + {{ item.dictName }} + {{ item.remark }} + {{ item.createTime }} + + + + + {{ item.points }} + + + + + + + {{ + loading ? "加载中..." : "上拉加载更多" + }} + + + + + 没有更多数据了 + + + + + + + 暂无积分记录 + + + + + + + + 时间奖励兑换 + + + + + + + + 当前时间奖励值: + {{ + (userInfo && userInfo.hourValue) || 0 + }} + + + + + 兑换数量: + + + + + + 兑换规则: + + • 1个时间奖励值 = {{ pointInfo.points || 0 }}积分 + + + + + + 取消 + 确认兑换 + + + + \ No newline at end of file +.points-detail-page { + min-height: 100vh; + background-color: #f5f5f5; +} + +/* 导航栏 */ +.nav-bar { + display: flex; + align-items: center; + justify-content: space-between; + height: 88rpx; + padding: 0 32rpx; + background-color: #fff; + border-bottom: 1rpx solid #eee; +} + +.nav-back { + width: 60rpx; + height: 60rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.nav-back .iconfont { + font-size: 36rpx; + color: #333; +} + +.nav-title { + font-size: 36rpx; + font-weight: 600; + color: #333; +} + +.nav-placeholder { + width: 60rpx; +} + +/* 积分总览 */ +.points-overview { + background: linear-gradient(135deg, #77f3f9 0%, #764ba2 100%); + padding: 60rpx 32rpx; + text-align: center; + position: relative; +} + +.total-points { + display: flex; + flex-direction: column; + align-items: center; +} + +.points-number { + font-size: 72rpx; + font-weight: bold; + color: #fff; + margin-bottom: 12rpx; +} + +.points-label { + font-size: 28rpx; + color: rgba(255, 255, 255, 0.8); +} + +/* 时间奖励值 */ +.time-reward { + position: absolute; + top: 30rpx; + right: 32rpx; + display: flex; + align-items: center; + background: rgba(255, 255, 255, 0.2); + border-radius: 30rpx; + padding: 6rpx 10rpx; + border: 1rpx solid rgba(255, 255, 255, 0.3); +} + +.reward-icon { + margin-right: 8rpx; + font-size: 26rpx; + display: flex; + align-items: center; + color: white; +} + +/* 筛选标签 */ +.filter-tabs { + display: flex; + background-color: #fff; + padding: 0 32rpx; +} + +.tab-item { + flex: 1; + text-align: center; + padding: 32rpx 0; + font-size: 30rpx; + color: #666; + position: relative; +} + +.tab-item.active { + color: #77f3f9; + font-weight: 600; +} + +.tab-item.active::after { + content: ""; + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + width: 60rpx; + height: 4rpx; + background-color: #77f3f9; + border-radius: 2rpx; +} + +/* 积分记录列表 */ +.points-list { + height: calc(100vh - 368rpx); + padding: 0 30rpx; + width: 690rpx; +} + +.record-item { + display: flex; + align-items: center; + justify-content: space-between; + background-color: #fff; + padding: 32rpx 24rpx; + margin-top: 20rpx; + border-radius: 16rpx; + box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05); +} + +.record-left { + display: flex; + align-items: center; + flex: 1; +} + +.record-icon { + width: 80rpx; + height: 80rpx; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + margin-right: 24rpx; +} + +.record-icon.income { + background-color: #e8f5e8; +} + +.record-icon.expense { + background-color: #ffeaea; +} + +.record-icon .iconfont { + font-size: 36rpx; +} + +.record-icon.income .iconfont { + color: #52c41a; +} + +.record-icon.expense .iconfont { + color: #ff4d4f; +} + +.record-info { + flex: 1; +} + +.record-title { + font-size: 32rpx; + color: #333; + font-weight: 500; + margin-bottom: 8rpx; +} + +.record-desc { + font-size: 26rpx; + color: #999; + margin-bottom: 8rpx; +} + +.record-time { + font-size: 24rpx; + color: #ccc; +} + +.record-right { + text-align: right; +} + +.record-points { + font-size: 32rpx; + font-weight: 600; +} + +.record-points.income { + color: #52c41a; +} + +.record-points.expense { + color: #ff4d4f; +} + +/* 加载状态 */ +.load-more, +.no-more { + text-align: center; + padding: 40rpx 0; +} + +.load-text, +.no-more-text { + font-size: 28rpx; + color: #999; +} + +/* 空状态 */ +.empty-state { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 120rpx 0; +} + +.empty-icon { + width: 200rpx; + height: 200rpx; + margin-bottom: 32rpx; + opacity: 0.6; +} + +.empty-text { + font-size: 28rpx; + color: #999; +} + +/* 兑换弹窗样式 */ +.exchange-modal { + width: 600rpx; + background: #fff; + border-radius: 20rpx; + overflow: hidden; +} + +.modal-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 40rpx 40rpx 20rpx; + border-bottom: 1rpx solid #f0f0f0; +} + +.modal-title { + font-size: 36rpx; + font-weight: 600; + color: #333; +} + +.close-btn { + width: 60rpx; + height: 60rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.modal-content { + padding: 40rpx; +} + +.current-reward { + display: flex; + align-items: center; + margin-bottom: 40rpx; + padding: 20rpx; + background: #f8f9fa; + border-radius: 12rpx; +} + +.reward-label { + font-size: 28rpx; + color: #666; +} + +.reward-value { + font-size: 32rpx; + font-weight: 600; + color: #77f3f9; + margin-left: 10rpx; +} + +.exchange-form { + margin-bottom: 40rpx; +} + +.form-item { + margin-bottom: 20rpx; +} + +.form-label { + font-size: 28rpx; + color: #333; + margin-bottom: 12rpx; + display: block; +} + +.form-input { + width: 100%; + height: 80rpx; + border: 1rpx solid #ddd; + border-radius: 8rpx; + padding: 0 20rpx; + font-size: 28rpx; + box-sizing: border-box; +} + +.exchange-result { + padding: 20rpx; + background: #e8f5e8; + border-radius: 8rpx; + margin-top: 20rpx; +} + +.result-text { + font-size: 28rpx; + color: #52c41a; + font-weight: 500; +} + +.exchange-rules { + padding: 20rpx; + background: #f8f9fa; + border-radius: 12rpx; +} + +.rules-title { + font-size: 28rpx; + font-weight: 600; + color: #333; + margin-bottom: 16rpx; + display: block; +} + +.rules-list { + display: flex; + flex-direction: column; + gap: 8rpx; +} + +.rule-item { + font-size: 24rpx; + color: #666; + line-height: 1.5; +} + +.modal-footer { + display: flex; + gap: 20rpx; + padding: 20rpx 40rpx 40rpx; +} + +.cancel-btn, +.confirm-btn { + flex: 1; + height: 80rpx; + border-radius: 8rpx; + font-size: 28rpx; + border: none; + display: flex; + align-items: center; + justify-content: center; +} + +.cancel-btn { + background: #f5f5f5; + color: #666; +} + +.confirm-btn { + background: #77f3f9; + color: #fff; +} + +.confirm-btn:disabled { + background: #ccc; + color: #999; +} + diff --git a/subPackages/techan/detail.vue b/subPackages/techan/detail.vue index b652de6..82b28dc 100644 --- a/subPackages/techan/detail.vue +++ b/subPackages/techan/detail.vue @@ -288,22 +288,17 @@ } }, - order(item) { + order() { let goods = this.sku[this.productIndex] goods.buyNum = this.buyNum - - let orderInfo = { - // is_post: goods.is_post || "2", - is_post: 1, - goods: [{goodsInfo: this.info, skuInfo: goods }], - post: 0, - } - - uni.setStorageSync('teChanOrder', JSON.stringify(orderInfo)); //规格 - // uni.setStorageSync('teChanInfo', JSON.stringify(this.info)); //商品 - uni.navigateTo({ - url: '/subPackages/techan/order' - }); + let list = [{ + ...goods, + specUrl:goods.imageUrl, + goodsName:this.info.goodsName, + quantity:goods.buyNum + }] + this.$store.commit("changeOrderSCart", list); + this.gotoPath("/subPackages/techan/order"); }, addToCart () { let goods = this.sku[this.productIndex] diff --git a/subPackages/techan/order - 副本.vue b/subPackages/techan/order - 副本.vue new file mode 100644 index 0000000..de98c67 --- /dev/null +++ b/subPackages/techan/order - 副本.vue @@ -0,0 +1,1278 @@ + + + + + + + + + + 收货地址 + + + 更多 + + + + + + + + + {{ contacts.name }} + {{ contacts.tel }} + + {{ contacts.province_text + contacts.city_text + contacts.district_text + contacts.detail_addr }} + + + + + 添加 + + + + + + + + + + + {{sku.goodsInfo.merchant_name}} + + + + + + {{ sku.goodsInfo.title }} + + {{sku.skuInfo.money/100}} + + + + {{ sku.skuInfo.title }} + + x{{sku.skuInfo.buyNum}} + + + + + + + 购买数量 + + + + - + + + + + + + + + 运费 + + + {{!sku.post?'免邮':sku.post/100}} + + + + + + + + + + + + + + + + + + + + 合计: + {{ total() }} + 含邮费:¥{{ post / 100 }} + + 立即支付 + + + + + + + + 取消 + 确定 + + + + 添加收货地址 + + + + + + {{ item.name }} + {{ item.tel }} + 默认 + + {{ item.province_text + item.city_text + item.district_text + item.detail_addr }} + + + + + + + + + + + + + + + 取消 + {{addressTitle}} + 保存 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/subPackages/techan/order.vue b/subPackages/techan/order.vue index a560f95..e39e8c9 100644 --- a/subPackages/techan/order.vue +++ b/subPackages/techan/order.vue @@ -1,1281 +1,2002 @@ - - - - + + + - - - - - 收货地址 - - - 更多 - - - - - - - - - {{ contacts.name }} - {{ contacts.tel }} - - {{ contacts.province_text + contacts.city_text + contacts.district_text + contacts.detail_addr }} - - - - - 添加 - - - - - - - - - - + + + + + 收货地址 + + + 更多 + + + + + + + + + {{ contacts.name }} + {{ contacts.tel }} + + {{ + contacts.province_text + + contacts.city_text + + contacts.district_text + + contacts.detail_addr + }} + + + + + 添加 + + + + + - - - - + - - - - - - 运费 - - - {{!sku.post?'免邮':sku.post/100}} - - + --> + + + + + {{ sku.goodsName }} + + {{ sku.salePrice }} + + + + {{ sku.specValueOne }}-{{ sku.specValueTwo }} + x{{ sku.quantity }} + + + + + 购买数量 + + + - + + + + + + - - - - - - - - - - - - - - - - - 合计: - {{ total() }} - 含邮费:¥{{ post / 100 }} - - 立即支付 - - - - - - - - 取消 - 确定 - - - - 添加收货地址 - - - - - - {{ item.name }} - {{ item.tel }} - 默认 - - {{ item.province_text + item.city_text + item.district_text + item.detail_addr }} - - - - - - - - - - - - - - - 取消 - {{addressTitle}} - 保存 - - - - - - - - - - - - - - + + + + + + 积分兑换 + + {{ + usePoints > 0 + ? `已抵扣¥${(usePoints / POINTS_TO_YUAN_RATIO).toFixed(2)}` + : "可用积分" + userPoints + }} + + + + + + + + + 备注 + + + + + + + + + + 运费 + 包邮 + + + + + + + 商品总价: + {{ getGoodsTotal() }} + + + 积分抵扣: + -¥{{ (usePoints / POINTS_TO_YUAN_RATIO).toFixed(2) }} + + + + + + + + 实付金额: + {{ total() }} + + + 立即支付 + 支付中... + + + + + + + + + 取消 + 确定 + + + + 添加收货地址 + + + + + + {{ item.name }} + {{ item.tel }} + 默认 + + {{ + item.province_text + + item.city_text + + item.district_text + + item.detail_addr + }} + + + + + + + + + + + + + + + 取消 + {{ + addressTitle + }} + 保存 + + + + + + + + + + + + + + 取消 + 积分兑换 + 确定 + + + + + + 兑换规则 + {{ POINTS_TO_YUAN_RATIO }}积分抵扣1元 + + + + + 当前{{ userPoints }}积分 + 本订单最多可用{{ getMaxUsablePoints() }}积分({{ + (getMaxUsablePoints() / POINTS_TO_YUAN_RATIO).toFixed(2) + }}元) + + + + + + + + + + 不使用积分 + + + + + + + + + 使用全部可用积分{{ getMaxUsablePoints() }}积分抵扣{{ + (getMaxUsablePoints() / POINTS_TO_YUAN_RATIO).toFixed(2) + }}元 + 最大可用积分数量 + + + + + + + \ No newline at end of file + diff --git a/subPackages/user/gwc.vue b/subPackages/user/gwc.vue index ebecf76..afac28e 100644 --- a/subPackages/user/gwc.vue +++ b/subPackages/user/gwc.vue @@ -374,7 +374,8 @@ .then((res) => { if (res.data.canOrder) { this.$store.commit("changeOrderSCart", list); - this.gotoPath("/subPackages/order/gwcOrder"); + this.gotoPath("/subPackages/techan/order"); + } else { uni.showToast({ title: res.message,