diff --git a/components/GPT/index.vue b/components/GPT/index.vue index 2116129..0baa773 100644 --- a/components/GPT/index.vue +++ b/components/GPT/index.vue @@ -408,6 +408,7 @@ export default { this.scrollToBottom(1000) await this.socketObj.init() this.$ClientData = new ClientData() + console.log(this.$ClientData,'ClientData') this.$ClientData.init() this.$ClientData.setAttr({ socketObj: this.socketObj }) this.robotObj = this.socketObj.robotObj diff --git a/components/GPT/utils/ClientData.js b/components/GPT/utils/ClientData.js index 30e6428..5e9c23f 100644 --- a/components/GPT/utils/ClientData.js +++ b/components/GPT/utils/ClientData.js @@ -1,4 +1,3 @@ -import Vue from "vue"; import { MESSAGE_TYPE } from "./chat_constant"; import { getQueryVariable, generateRequestId, arrayUnique } from "./util"; import { v4 as uuidv4 } from "uuid"; diff --git a/pages/agent/index.vue b/pages/agent/index.vue index cd7197f..95200cf 100644 --- a/pages/agent/index.vue +++ b/pages/agent/index.vue @@ -13,17 +13,19 @@ export default { data() { return { - agentId:1 + agentId:'' } }, onLoad(option) { + if(option){ + this.agentId = option.id + console.log('>>>>>>接受的ID',this.agentId) + } wx.hideShareMenu() const app = getApp(); const bgMusic = app.globalData.bgMusic; bgMusic.pause(); - if(option){ - this.agentId = option.id - } + }, onLaunch: options => { this.options = options diff --git a/pages/index/timeShopBank.vue b/pages/index/timeShopBank.vue index eb91bb0..48a8f1a 100644 --- a/pages/index/timeShopBank.vue +++ b/pages/index/timeShopBank.vue @@ -76,7 +76,7 @@ /> - + { + if (res.code === 200) { + // 将逗号分隔的字符串转换为数组 + this.whiteListUsers = res.msg.split(",").map((item) => item.trim()); + console.log("白名单用户列表:", this.whiteListUsers); + } + }) + .catch((err) => { + console.error("获取白名单配置失败:", err); + }); + }, + // 切换到关注标签时刷新关注列表 refreshFollowList() { // 获取FollowTab组件实例并调用其刷新方法 @@ -272,6 +304,20 @@ export default { }); return; } + + // 检查当前用户是否在白名单中 + const userId = this.userInfo.id.toString(); + if ( + this.whiteListUsers.length > 0 && + !this.whiteListUsers.includes(userId) + ) { + uni.showToast({ + title: "暂无发布权限", + icon: "none", + }); + return; + } + uni.navigateTo({ url: "/pages/notes/publish", }); diff --git a/subPackages/haveFeeling/list.vue b/subPackages/haveFeeling/list.vue index c2dbe43..894dfbd 100644 --- a/subPackages/haveFeeling/list.vue +++ b/subPackages/haveFeeling/list.vue @@ -30,11 +30,21 @@ - 有感商品订单 - {{ - order.supplierName || "默认供应商" - }} - 订单号:{{ ( order.status==0||order.status==-1)?order.parentOrderNo:order.orderNo }} + 有感商品订单 + {{ + order.supplierName || "默认供应商" + }} + 订单号:{{ + order.status == 0 || order.status == -1 + ? order.parentOrderNo + : order.orderNo + }} {{ @@ -77,11 +87,27 @@ - + - ¥{{ order.orders[0].payAmount || 0 }} - ¥{{ order.payAmount || 0 }} + ¥{{ order.orders[0].payAmount || 0 }} + 含运费{{ order.orders[0].shippingFee || 0 }} + + ¥{{ order.payAmount || 0 + }}含运费{{ order.shippingFee || 0 }} + {{ order.createTime }} @@ -222,12 +248,12 @@ export default { pageSize: this.pageSize, status: this.tabs[this.currentTab].status, }; - let url = '' - if(this.currentTab==0||this.currentTab==1){ - url = "/framework/ygOrder/parent/pageList" - }else{ - url = "/framework/ygOrder/pageList" - } + let url = ""; + if (this.currentTab == 0 || this.currentTab == 1) { + url = "/framework/ygOrder/parent/pageList"; + } else { + url = "/framework/ygOrder/pageList"; + } this.Post( { ...params, @@ -236,15 +262,15 @@ export default { "DES" ).then((res) => { if (res.code == 200) { - if(this.currentTab==0||this.currentTab==1){ - let orderItems = [] - res.rows.forEach(item =>{ - item.orderItems = [] - item.orders.forEach(_item =>{ - item.orderItems.push(..._item.orderItems) - }) - }) - } + if (this.currentTab == 0 || this.currentTab == 1) { + let orderItems = []; + res.rows.forEach((item) => { + item.orderItems = []; + item.orders.forEach((_item) => { + item.orderItems.push(..._item.orderItems); + }); + }); + } this.orderList.push(...res.rows); console.log(this.orderList); this.hasMore = res.rows.length === this.pageSize; @@ -440,17 +466,16 @@ export default { // 跳转到订单详情页面 goToOrderDetail(order) { - console.log(order) - if(order.status==-1||order.status==0){ - uni.navigateTo({ - url: `/subPackages/haveFeeling/detailAll?id=${order.orderNo}`, - }); - }else{ - uni.navigateTo({ - url: `/subPackages/haveFeeling/detail?id=${order.orderNo}`, - }); - } - + console.log(order); + if (order.status == -1 || order.status == 0) { + uni.navigateTo({ + url: `/subPackages/haveFeeling/detailAll?id=${order.orderNo}`, + }); + } else { + uni.navigateTo({ + url: `/subPackages/haveFeeling/detail?id=${order.orderNo}`, + }); + } }, }, }; @@ -749,6 +774,13 @@ $bg-light: #f7fafc; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, Simsun, sans-serif; + + .freight-text { + font-size: 22rpx; + color: $text-muted; + font-weight: 400; + margin-left: 8rpx; + } } .order-time { diff --git a/subPackages/techan/order.vue b/subPackages/techan/order.vue index a1a3948..786c7d2 100644 --- a/subPackages/techan/order.vue +++ b/subPackages/techan/order.vue @@ -96,8 +96,7 @@ - {{ sku.specValueOne }}-{{ sku.specValueTwo }} x{{ sku.quantity }} @@ -170,7 +169,9 @@ 运费: - 包邮 + {{ + post > 0 ? "¥" + post.toFixed(2) : "包邮" + }} 积分抵扣: @@ -475,7 +476,7 @@ export default { // 获取总积分 async getTotalPoints() { try { - if(!uni.getStorageSync("userInfo") )return + if (!uni.getStorageSync("userInfo")) return; this.Post({}, "/framework/points/getLastBalance", "DES").then((res) => { if (res.code === 200) { this.userPoints = res.data.balance || 0; @@ -598,32 +599,9 @@ export default { if (this.info.is_post == 0 || !this.contacts) { return; } - this.flag = false; - - let param = []; - this.info.goods.forEach((v) => { - param.push({ - specifications_id: v.skuInfo.id, - num: v.skuInfo.quantity, - consignee_id: this.contacts.id, - }); - }); - let data = JSON.stringify(param); - // console.log(data); - this.Post({ data: data }, "/api/order/getNewPost") - .then((res) => { - if (res) { - for (let i = 0; i < this.info.goods.length; i++) { - this.info.goods[i].post = res.data[i].post_money; - } - this.flag = true; - } - }) - .catch((err) => { - // console.log(err, "aaaaaaa"); - this.flag = true; - }); + // 调用新的运费计算方法 + this.calculateFreight(); }, plus(sku) { @@ -800,10 +778,56 @@ export default { return "¥" + allPriceYuan.toFixed(2); }, - // 获取总运费(单位:分) + // 获取总运费(单位:元) getTotalPost() { - // 运费暂时设为0 - return 0; + // 如果有计算的运费,则返回运费,否则返回0 + return this.post ? this.post : 0; + }, + + // 计算运费 + calculateFreight() { + if (!this.contacts) { + return; + } + + this.flag = false; + + // 构建商品数组信息,不根据供应商区分 + let shoppingCartBoList = []; + this.info.forEach((sku) => { + shoppingCartBoList.push({ + goodsId: sku.goodsId, + specId: sku.specId, + quantity: sku.quantity, + }); + }); + + // 调用运费计算接口 + this.Post( + { + shoppingCartBoList: this.info, + userContactId: this.contacts.id, + method: "POST", + }, + "/framework/ygOrder/calculateMultiSpecFreight", + "DES" + ) + .then((res) => { + if (res && res.code === 200) { + this.post = Number(res.data.total) || 0; + this.flag = true; + } else { + uni.showToast({ + title: res.msg || "运费计算失败", + icon: "none", + }); + this.flag = true; + } + }) + .catch((err) => { + console.error("运费计算错误:", err); + this.flag = true; + }); }, // 获取当前订单最大可用积分 @@ -946,7 +970,7 @@ export default { expectedAmount: this.allprice, usePoints: this.usePoints ? 0 : 1, // 是否使用积分 pointsQuantity: parseInt(this.usePoints) || 0, // 使用的积分数量 - shippingFee: 0, + shippingFee: this.post || 0, // 使用计算出的运费 }; this.Post( @@ -965,13 +989,13 @@ export default { interval: 2000, onSuccess: (data) => { this.isOrderLoading = false; // 结束加载 - this.getTotalPoints(); + this.getTotalPoints(); // 处理成功逻辑 // uni.showToast({ // title: "订单创建成功", // icon: "success", // }); - this.orderPay(res.msg) + this.orderPay(res.msg); }, onFailure: (data) => { this.isOrderLoading = false; // 结束加载 @@ -1006,36 +1030,36 @@ export default { }); }); }, - orderPay(token){ - this.Post( - { - method: "POST", - orderNo:token, - fromType:1, - payAmount:this.allprice, - }, - "/framework/wxPay/submitShopPurOrder", - "DES" - ).then(res =>{ - uni.requestPayment({ - nonceStr: res.data.wxInfo.nonceStr, - package: res.data.wxInfo.package, - paySign: res.data.wxInfo.paySign, - signType: res.data.wxInfo.signType, - timeStamp: res.data.wxInfo.timeStamp, - success: () => { - uni.redirectTo({ - url:'/subPackages/haveFeeling/list' - }) - }, - fail() { - uni.redirectTo({ - url:'/subPackages/haveFeeling/list' - }) - } - }); - }) - }, + orderPay(token) { + this.Post( + { + method: "POST", + orderNo: token, + fromType: 1, + payAmount: this.allprice, + }, + "/framework/wxPay/submitShopPurOrder", + "DES" + ).then((res) => { + uni.requestPayment({ + nonceStr: res.data.wxInfo.nonceStr, + package: res.data.wxInfo.package, + paySign: res.data.wxInfo.paySign, + signType: res.data.wxInfo.signType, + timeStamp: res.data.wxInfo.timeStamp, + success: () => { + uni.redirectTo({ + url: "/subPackages/haveFeeling/list", + }); + }, + fail() { + uni.redirectTo({ + url: "/subPackages/haveFeeling/list", + }); + }, + }); + }); + }, // ---------------自提----------------------- changPopShow(e) {