From 946ced7f59f26d7f7b9aa56b0a4ecd707c385e78 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Tue, 7 Nov 2023 16:54:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E7=A0=81=E5=85=A5=E5=BA=93=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8F=AF=E4=BF=AE=E6=94=B9=E5=8E=9F=E6=9C=89=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/wholesale/wholesale/wholesale.vue | 135 +++++++++++++++++++++++- 1 file changed, 134 insertions(+), 1 deletion(-) diff --git a/pages/wholesale/wholesale/wholesale.vue b/pages/wholesale/wholesale/wholesale.vue index 4526184..9a0eb1f 100644 --- a/pages/wholesale/wholesale/wholesale.vue +++ b/pages/wholesale/wholesale/wholesale.vue @@ -150,6 +150,25 @@ + + + + + + + + {{goodsNum}} + + + + ¥{{totalMoney}} + 支持配送 售后无忧 + + + 去结算 + @@ -200,6 +219,11 @@ import { getconfig, } from '@/api/public.js'; + import { + getCartCounts, + getCartList, + + } from '@/api/requesta.js'; const app = getApp(); export default { components: { @@ -231,6 +255,8 @@ domain: HTTP_REQUEST_URL, productList: [], is_switch: true, + goodsNum: 0, + totalMoney: 0, where: { cate_id: '', order: '', @@ -334,8 +360,11 @@ this.get_host_product(); this.getClassfication(); this.getStoreType(); - this.tabIndex = 2 + // this.tabIndex = 2 }, + onShow() { + this.cartFn() + }, onReady() {}, mounted() { uni.getStorage({ @@ -791,6 +820,55 @@ }) } }, + skuaddcart() { + this.showcartpop = false + // this.skuform = {} + let res = postCartAdd({ + cart_num: this.skuNumber, + is_new: 0, + product_attr_unique: this.skuform.sku[this.skusize].unique, + product_id: this.skuform.product_id, + product_type: this.skuform.product_type, + spread_id: "", + }).then((res, err) => { + this.cartFn() + uni.showToast({ + title: "加入成功", + duration: 1000, + + }) + }).catch(err => { + // this.act_cart = false + uni.showToast({ + title: err, + icon: "none", + duration: 1000, + }) + }) + + }, + cartFn() { + getCartList().then(res => { + // console.log(res) + this.totalMoney = 0 + this.cartList = res.data.list + this.cartList.forEach(e => { + e.list.forEach(item => { + this.totalMoney += item.cart_num * item.productAttr.price + }) + + }) + this.totalMoney = this.totalMoney.toFixed(2) + }) + getCartCounts().then(res => { + this.goodsNum = res.data[0].count + }) + }, + navgo(url){ + uni.navigateTo({ + url: url + }) + } }, onPullDownRefresh() { @@ -1661,4 +1739,59 @@ } } } + .card { + width: 720rpx; + z-index: 99; + // margin:auto; + left: 50%; + transform: translateX(-50%); + position: fixed; + // bottom: 0; + background-color: #333333; + height: 101.64rpx; + border-radius: 50.82rpx; + overflow: hidden; + color: white; + display: flex; + justify-content: space-between; + box-sizing: border-box; + + .left { + display: flex; + align-items: center; + padding: 10rpx 35rpx; + + .tot_price { + display: flex; + margin-left: 42rpx; + flex-direction: column; + justify-content: space-between; + } + .badge { + position: absolute; + top: 0; + right: 0; + background-color: #f84221; + transform: translate(50%, -50%); + // padding: 10rpx 10rpx; + border-radius: 35rpx; + text-align: center; + width: 35rpx; + line-height: 35rpx; + height: 35rpx; + } + } + + .right { + font-size: 33.29rpx; + line-height: 50px; + background: linear-gradient(to right, #f84221, #ff6d20); + width: 140.19rpx; + text-align: center; + } + } + .act_cart { + transition: 0.5s; + transform: scale(1.1); + } \ No newline at end of file