适配重构促销

master
paulGao 2021-12-11 13:48:18 +08:00
parent 17f23fe920
commit 4064c56b21
9 changed files with 401 additions and 189 deletions

View File

@ -1,35 +1,48 @@
<template> <template>
<div class="wrapper"> <div class="wrapper">
<u-popup class="popup" v-model="buyMask" :height="setup.height" closeable :mode="setup.mode" <u-popup
:border-radius="setup.radius" @close="closeMask()"> class="popup"
v-model="buyMask"
:height="setup.height"
closeable
:mode="setup.mode"
:border-radius="setup.radius"
@close="closeMask()"
>
<!-- 商品 --> <!-- 商品 -->
<view class="goods-box bottom"> <view class="goods-box bottom">
<view class="goods-header"> <view class="goods-header">
<view class="goods-img"> <view class="goods-img">
<u-image width="200rpx" border-radius="20" class="uimage" height="200rpx" <u-image
:src="selectedSpecImg ? selectedSpecImg : goodsDetail.thumbnail"></u-image> width="200rpx"
border-radius="20"
class="uimage"
height="200rpx"
:src="selectedSpecImg ? selectedSpecImg : goodsDetail.thumbnail"
></u-image>
</view> </view>
<view class="goods-skus"> <view class="goods-skus">
<!-- 有活动商品价格 --> <!-- 有活动商品价格 -->
<view class="goods-price " v-if="goodsDetail.promotionPrice"> <view class="goods-price" v-if="goodsDetail.promotionPrice">
<span v-if="goodsDetail.promotionPrice && !pointDetail"> <span v-if="goodsDetail.promotionPrice && !pointDetail">
<span <span class="goods-price-promotionShow goods-price-bigshow">{{
class="goods-price-promotionShow goods-price-bigshow">{{ formatPrice(goodsDetail.promotionPrice)[0] }}</span> formatPrice(goodsDetail.promotionPrice)[0]
}}</span>
.{{ formatPrice(goodsDetail.promotionPrice)[1] }} .{{ formatPrice(goodsDetail.promotionPrice)[1] }}
</span> </span>
<span v-if="pointDetail.points"> <span v-if="pointDetail.points">
<span class="goods-price-promotionShow goods-price-bigshow">{{ pointDetail.points }}</span> <span class="goods-price-promotionShow goods-price-bigshow">{{
pointDetail.points
}}</span>
积分 积分
</span> </span>
<div class="promotion-box"> <div class="promotion-box">
<span class="goods-price-bigshow">{{ <span class="goods-price-bigshow">{{
formatPrice(goodsDetail.price)[0] formatPrice(goodsDetail.price)[0]
}}</span> }}</span>
.{{ formatPrice(goodsDetail.price)[1] }} .{{ formatPrice(goodsDetail.price)[1] }}
</div> </div>
</view> </view>
<!-- 正常商品的价格 --> <!-- 正常商品的价格 -->
@ -37,10 +50,9 @@
<span> <span>
<span class="goods-price-bigshow">{{ <span class="goods-price-bigshow">{{
formatPrice(goodsDetail.price)[0] formatPrice(goodsDetail.price)[0]
}}</span> }}</span>
.{{ formatPrice(goodsDetail.price)[1] }} .{{ formatPrice(goodsDetail.price)[1] }}
</span> </span>
</view> </view>
<view class="goods-check-skus"> <view class="goods-check-skus">
@ -55,36 +67,61 @@
<!-- 商品信息 --> <!-- 商品信息 -->
<scroll-view class="goods-skus-box" :scroll-y="true"> <scroll-view class="goods-skus-box" :scroll-y="true">
<!-- 规格 --> <!-- 规格 -->
<view class="goods-skus-view" :key="specIndex" v-for="(spec, specIndex) in formatList"> <view
class="goods-skus-view"
:key="specIndex"
v-for="(spec, specIndex) in formatList"
>
<view class="skus-view-list"> <view class="skus-view-list">
<view class="view-class-title">{{ spec.name }}</view> <view class="view-class-title">{{ spec.name }}</view>
<!-- 正常逻辑 循环出sku --> <!-- 正常逻辑 循环出sku -->
<view v-if="!parentOrder" :class="{ active: spec_val.value == currentSelceted[specIndex] }" class="skus-view-item" <view
v-for="(spec_val, spec_index) in spec.values" :key="spec_index" v-if="!parentOrder"
@click="handleClickSpec(spec, specIndex, spec_val)">{{ spec_val.value }} </view> :class="{ active: spec_val.value == currentSelceted[specIndex] }"
class="skus-view-item"
v-for="(spec_val, spec_index) in spec.values"
:key="spec_index"
@click="handleClickSpec(spec, specIndex, spec_val)"
>{{ spec_val.value }}
</view>
<!-- 拼团购买仅筛选出当前拼团类型商品 --> <!-- 拼团购买仅筛选出当前拼团类型商品 -->
<view v-if="parentOrder && spec_val.skuId == goodsDetail.id" :class="{ active: spec_val.value == currentSelceted[specIndex] }" class="skus-view-item" <view
v-for="(spec_val, spec_index) in spec.values" :key="spec_index" v-if="parentOrder && spec_val.skuId == goodsDetail.id"
@click="handleClickSpec(spec, specIndex, spec_val)">{{ spec_val.value }} </view> :class="{ active: spec_val.value == currentSelceted[specIndex] }"
class="skus-view-item"
v-for="(spec_val, spec_index) in spec.values"
:key="spec_index"
@click="handleClickSpec(spec, specIndex, spec_val)"
>{{ spec_val.value }}
</view>
</view> </view>
</view> </view>
<!-- 数量 --> <!-- 数量 -->
<view class="goods-skus-number"> <view class="goods-skus-number">
<view class="view-class-title">数量</view> <view class="view-class-title">数量</view>
<u-number-box :bg-color="numberBox.bgColor" :max="200" :color="numberBox.color" <u-number-box
:input-width="numberBox.width" :input-height="numberBox.height" :size="numberBox.size" :min="1" :bg-color="numberBox.bgColor"
v-model="num"> :max="200"
:color="numberBox.color"
:input-width="numberBox.width"
:input-height="numberBox.height"
:size="numberBox.size"
:min="1"
v-model="num"
>
</u-number-box> </u-number-box>
</view> </view>
</scroll-view> </scroll-view>
<!-- 按钮 --> <!-- 按钮 -->
<view class="btns"> <view class="btns">
<view
<view class="box-btn card" v-if="buyType != 'PINTUAN' && goodsDetail.goodsType!='VIRTUAL_GOODS'" class="box-btn card"
@click="addToCartOrBuy('cart')">加入购物车</view> v-if="buyType != 'PINTUAN' && goodsDetail.goodsType != 'VIRTUAL_GOODS'"
@click="addToCartOrBuy('cart')"
>加入购物车</view
>
<view class="box-btn buy" @click="addToCartOrBuy('buy')"></view> <view class="box-btn buy" @click="addToCartOrBuy('buy')"></view>
</view> </view>
</view> </view>
@ -140,10 +177,10 @@ export default {
default: "", default: "",
type: null, type: null,
}, },
pointDetail:{ pointDetail: {
default: "", default: "",
type: null, type: null,
} },
}, },
watch: { watch: {
buyType: { buyType: {
@ -161,8 +198,6 @@ export default {
}, },
methods: { methods: {
// 1999 --> [1999,00] // 1999 --> [1999,00]
formatPrice(val) { formatPrice(val) {
if (typeof val == "undefined") { if (typeof val == "undefined") {
@ -215,7 +250,7 @@ export default {
} }
}, },
/** /**
* 直接购买 * 直接购买
*/ */
buy(data) { buy(data) {
@ -232,7 +267,6 @@ export default {
}); });
}, },
/** /**
* 添加到购物车或购买 * 添加到购物车或购买
*/ */
@ -276,9 +310,7 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: `/pages/order/fillorder?way=${data.cartType}&addr=${ url: `/pages/order/fillorder?way=${data.cartType}&addr=${
this.addr.id || "" this.addr.id || ""
}&parentOrder=${encodeURIComponent( }&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`,
JSON.stringify(this.parentOrder)
)}`,
}); });
} }
}); });
@ -286,7 +318,6 @@ export default {
}, },
formatSku(list) { formatSku(list) {
// //
console.log(list);
let arr = [{}]; let arr = [{}];
list.forEach((item, index) => { list.forEach((item, index) => {
item.specValues.forEach((spec, specIndex) => { item.specValues.forEach((spec, specIndex) => {
@ -315,7 +346,6 @@ export default {
return key.name; return key.name;
}); });
if (!keys.includes(name)) { if (!keys.includes(name)) {
console.log(name, values);
arr.push({ arr.push({
name: name, name: name,
values: [values], values: [values],

View File

@ -28,7 +28,7 @@
<span v-if="item.scopeType == 'PORTION_CATEGORY'"></span> <span v-if="item.scopeType == 'PORTION_CATEGORY'"></span>
<view v-else>{{ item.storeName == 'platform' ? '' :item.storeName+'' }}使</view> <view v-else>{{ item.storeName == 'platform' ? '' :item.storeName+'' }}使</view>
</view> </view>
<view>有效期至{{ item.endTime.split(" ")[0] }}</view> <view v-if="item.endTime">{{ item.endTime.split(" ")[0] }}</view>
</view> </view>
<view class="receive" @click="receive(item)"> <view class="receive" @click="receive(item)">
<text>点击</text><br /> <text>点击</text><br />

View File

@ -1,31 +1,60 @@
<template> <template>
<div class="main-page"> <div class="main-page">
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<view class="status_bar"></view> <view class="status_bar"></view>
<!-- #endif --> <!-- #endif -->
<!-- 仅h5有效 打开App --> <!-- 仅h5有效 打开App -->
<!-- 分享 --> <!-- 分享 -->
<shares v-if="shareFlage && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId" <shares
:link="'/pages/product/goods?id='+this.routerVal.id+'&goodsId='+this.routerVal.goodsId" v-if="shareFlage && goodsDetail.id"
:thumbnail="goodsDetail.thumbnail" :goodsName="goodsDetail.goodsName" type="goods" @close="shareFlage = false" /> :skuId="this.routerVal.id"
<popups v-model="popupsSwitch" @tapPopup="handleNavbarList" :popData="navbarListData" :x="navbarListX" :goodsId="this.routerVal.goodsId"
:y="navbarListY" placement="top-start" /> :link="
'/pages/product/goods?id=' +
this.routerVal.id +
'&goodsId=' +
this.routerVal.goodsId
"
:thumbnail="goodsDetail.thumbnail"
:goodsName="goodsDetail.goodsName"
type="goods"
@close="shareFlage = false"
/>
<popups
v-model="popupsSwitch"
@tapPopup="handleNavbarList"
:popData="navbarListData"
:x="navbarListX"
:y="navbarListY"
placement="top-start"
/>
<view class="index"> <view class="index">
<!-- topBar --> <!-- topBar -->
<u-navbar :background="navbar" :is-back="false" :class="headerFlag ? 'header' : 'header bg-none scroll-hide'"> <u-navbar
:background="navbar"
:is-back="false"
:class="headerFlag ? 'header' : 'header bg-none scroll-hide'"
>
<div class="headerRow"> <div class="headerRow">
<div class="backs"> <div class="backs">
<u-icon @click="back()" name="arrow-left" class="icon-back"></u-icon> <u-icon @click="back()" name="arrow-left" class="icon-back"></u-icon>
<u-icon name="list" @click="popupsSwitch = !popupsSwitch" class="icon-list"></u-icon> <u-icon
name="list"
@click="popupsSwitch = !popupsSwitch"
class="icon-list"
></u-icon>
</div> </div>
<div class="headerList" :class="headerFlag ? 'tab-bar' : 'tab-bar scroll-hide'"> <div class="headerList" :class="headerFlag ? 'tab-bar' : 'tab-bar scroll-hide'">
<div class="headerRow"> <div class="headerRow">
<div class="nav-item" v-for="header in headerList" :key="header.id" <div
:class="{ cur: scrollId === header.id }" @click="headerTab(header.id)"> class="nav-item"
v-for="header in headerList"
:key="header.id"
:class="{ cur: scrollId === header.id }"
@click="headerTab(header.id)"
>
{{ header.text }} {{ header.text }}
</div> </div>
</div> </div>
@ -33,27 +62,57 @@
</div> </div>
</u-navbar> </u-navbar>
<u-navbar :border-bottom="false" v-show="!headerFlag" class="header-only-back" :background="navbarOnlyBack" <u-navbar
:is-back="false"> :border-bottom="false"
v-show="!headerFlag"
class="header-only-back"
:background="navbarOnlyBack"
:is-back="false"
>
<div> <div>
<div class="bg-back"> <div class="bg-back">
<u-icon size="40" @click="back()" name="arrow-left" class="icon-back"></u-icon> <u-icon
<u-icon size="40" @click="popupsSwitch = !popupsSwitch" name="list" class="icon-list"></u-icon> size="40"
@click="back()"
name="arrow-left"
class="icon-back"
></u-icon>
<u-icon
size="40"
@click="popupsSwitch = !popupsSwitch"
name="list"
class="icon-list"
></u-icon>
</div> </div>
</div> </div>
</u-navbar> </u-navbar>
</view> </view>
<view class="product-container" :style="{ height: productRefHeight }" ref="productRef" id="productRef"> <view
<scroll-view scroll-anchoring enableBackToTop="true" scroll-with-animation scroll-y class="scroll-page" class="product-container"
:scroll-top="tabScrollTop" @scroll="pageScroll"> :style="{ height: productRefHeight }"
ref="productRef"
id="productRef"
>
<scroll-view
scroll-anchoring
enableBackToTop="true"
scroll-with-animation
scroll-y
class="scroll-page"
:scroll-top="tabScrollTop"
@scroll="pageScroll"
>
<view> <view>
<!-- 轮播图 --> <!-- 轮播图 -->
<GoodsSwiper id="main1" :res="imgList" /> <GoodsSwiper id="main1" :res="imgList" />
<!-- 促销活动条 --> <!-- 促销活动条 -->
<PromotionAssembleLayout v-if="PromotionList" :detail="goodsDetail" :res="PromotionList" /> <PromotionAssembleLayout
v-if="PromotionList"
:detail="goodsDetail"
:res="PromotionList"
/>
<view class="card-box top-radius-0" id="main2"> <view class="card-box top-radius-0" id="main2">
<!-- 活动不显示价钱 --> <!-- 活动不显示价钱 -->
@ -63,14 +122,20 @@
{{ goodsDetail.goodsName || "" }} {{ goodsDetail.goodsName || "" }}
</view> </view>
<view class="favorite" @click="clickFavorite(goodsDetail.id)"> <view class="favorite" @click="clickFavorite(goodsDetail.id)">
<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'" :name="favorite ? 'heart-fill' : 'heart'"> <u-icon
size="30"
:color="favorite ? '#f2270c' : '#262626'"
:name="favorite ? 'heart-fill' : 'heart'"
>
</u-icon> </u-icon>
<view :style="{ color: favorite ? '#f2270c' : '#262626' }">{{ favorite ? "已收藏" : "收藏" }}</view> <view :style="{ color: favorite ? '#f2270c' : '#262626' }">{{
favorite ? "已收藏" : "收藏"
}}</view>
</view> </view>
</view> </view>
<!-- 商品描述 --> <!-- 商品描述 -->
<view class="-goods-desc"> <view class="-goods-desc">
{{ goodsDetail.sellingPoint || '' }} {{ goodsDetail.sellingPoint || "" }}
</view> </view>
</view> </view>
<view v-else class="-goods-msg"> <view v-else class="-goods-msg">
@ -79,31 +144,41 @@
<view class="-goods-flex"> <view class="-goods-flex">
<!-- 如果有积分显示积分 --> <!-- 如果有积分显示积分 -->
<view class="-goods-price" v-if="goodsDetail.price != undefined"> <view class="-goods-price" v-if="goodsDetail.price != undefined">
<span v-if="pointDetail.points"> <span class="price">{{pointDetail.points}}</span> <span v-if="pointDetail.points">
<span class="price">{{ pointDetail.points }}</span>
<span>积分</span> <span>积分</span>
</span> </span>
<span v-else> <span>¥</span><span class="price">{{ formatPrice(goodsDetail.price)[0] }}</span>.{{ <span v-else>
formatPrice(goodsDetail.price)[1] <span>¥</span
}} </span> ><span class="price">{{ formatPrice(goodsDetail.price)[0] }}</span
>.{{ formatPrice(goodsDetail.price)[1] }}
</span>
</view>
<view class="-goods-price" v-else>
¥<span class="price">0 </span>.00
</view> </view>
<view class="-goods-price" v-else> ¥<span class="price">0 </span>.00 </view>
<view class="icons share" @click="shareChange()"> <view class="icons share" @click="shareChange()">
<u-icon size="30" name="share-fill"></u-icon> <u-icon size="30" name="share-fill"></u-icon>
<view>分享</view> <view>分享</view>
</view> </view>
<view class="icons" @click="clickFavorite(goodsDetail.id)"> <view class="icons" @click="clickFavorite(goodsDetail.id)">
<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'" <u-icon
:name="favorite ? 'heart-fill' : 'heart'"></u-icon> size="30"
<view :style="{ color: favorite ? '#f2270c' : '#262626' }">{{ favorite ? "已收藏" : "收藏" }}</view> :color="favorite ? '#f2270c' : '#262626'"
:name="favorite ? 'heart-fill' : 'heart'"
></u-icon>
<view :style="{ color: favorite ? '#f2270c' : '#262626' }">{{
favorite ? "已收藏" : "收藏"
}}</view>
</view> </view>
</view> </view>
<view class="-goods-name desc-bold"> <view class="-goods-name desc-bold">
{{ goodsDetail.goodsName || "" }} {{ goodsDetail.goodsName || "" }}
</view> </view>
<view class="-goods-desc"> <view class="-goods-desc">
{{ goodsDetail.sellingPoint || '' }} {{ goodsDetail.sellingPoint || "" }}
</view> </view>
</view> </view>
</view> </view>
@ -123,16 +198,22 @@
</view> </view>
<!-- 拼团用户列表 --> <!-- 拼团用户列表 -->
<PromotionAssembleListLayout v-if="isGroup" @to-assemble-buy-now="toAssembleBuyNow" :res="PromotionList" /> <PromotionAssembleListLayout
v-if="isGroup"
@to-assemble-buy-now="toAssembleBuyNow"
:res="PromotionList"
/>
<!-- 配置地址 如果是虚拟产品的时候不展示 --> <!-- 配置地址 如果是虚拟产品的时候不展示 -->
<view class="card-box" v-if="goodsDetail.goodsType !='VIRTUAL_GOODS'"> <view class="card-box" v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'">
<view class="card-flex" @click="shutMask(4)"> <view class="card-flex" @click="shutMask(4)">
<view class="card-title"> 已选 </view> <view class="card-title"> 已选 </view>
<view class="card-content"> <view class="card-content">
<span v-if="selectedGoods.spec">{{ selectedGoods.spec.specName }}-{{ <span v-if="selectedGoods.spec"
>{{ selectedGoods.spec.specName }}-{{
selectedGoods.spec.specValue selectedGoods.spec.specValue
}}</span> }}</span
>
<span v-else></span> <span v-else></span>
</view> </view>
<view class="card-bottom"> <view class="card-bottom">
@ -157,11 +238,21 @@
<Evaluation id="main5" :goodsDetail="goodsDetail" /> <Evaluation id="main5" :goodsDetail="goodsDetail" />
<!-- 店铺推荐 --> <!-- 店铺推荐 -->
<storeLayout id="main7" :storeDetail="storeDetail" :goodsDetail="goodsDetail" :res="recommendList" /> <storeLayout
id="main7"
:storeDetail="storeDetail"
:goodsDetail="goodsDetail"
:res="recommendList"
/>
<!-- 宝贝详情 --> <!-- 宝贝详情 -->
<GoodsIntro id="main9" :res="goodsDetail" :goodsParams="goodsParams" :goodsId="goodsDetail.goodsId" <GoodsIntro
v-if="goodsDetail.id" /> id="main9"
:res="goodsDetail"
:goodsParams="goodsParams"
:goodsId="goodsDetail.goodsId"
v-if="goodsDetail.id"
/>
<!-- 宝贝推荐 --> <!-- 宝贝推荐 -->
<GoodsRecommend id="main11" :res="likeGoodsList" /> <GoodsRecommend id="main11" :res="likeGoodsList" />
@ -186,8 +277,13 @@
</view> </view>
<!-- 正常结算页面 --> <!-- 正常结算页面 -->
<view class="detail-btn" v-if="!isGroup"> <view class="detail-btn" v-if="!isGroup">
<view class="to-store-car to-store-btn" v-if="goodsDetail.goodsType!='VIRTUAL_GOODS'" @click="shutMask(4)"> <view
加入购物车</view> class="to-store-car to-store-btn"
v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'"
@click="shutMask(4)"
>
加入购物车</view
>
<view class="to-buy to-store-btn" @click="shutMask(4, 'buy')">立即购买</view> <view class="to-buy to-store-btn" @click="shutMask(4, 'buy')">立即购买</view>
<view class="to-store-car to-store-btn" v-if="startTimer"></view> <view class="to-store-car to-store-btn" v-if="startTimer"></view>
</view> </view>
@ -206,8 +302,15 @@
<!-- 规格-模态层弹窗 --> <!-- 规格-模态层弹窗 -->
<view class="spec"> <view class="spec">
<!-- 促销弹窗 --> <!-- 促销弹窗 -->
<u-popup v-model="promotionFlag" :height="setup.height" :mode="setup.mode" :border-radius="setup.radius" <u-popup
@close="promotionFlag=false" :mask-close-able="setup.close" closeable> v-model="promotionFlag"
:height="setup.height"
:mode="setup.mode"
:border-radius="setup.radius"
@close="promotionFlag = false"
:mask-close-able="setup.close"
closeable
>
<view class="header-title">优惠</view> <view class="header-title">优惠</view>
<view class="cuxiao"> <view class="cuxiao">
<scroll-view class="scroll_mask" :scroll-y="true"> <scroll-view class="scroll_mask" :scroll-y="true">
@ -216,7 +319,6 @@
<PromotionDetailsLayout :res="PromotionList" /> <PromotionDetailsLayout :res="PromotionList" />
</view> </view>
<view class="con-cuxiao coupons"> <view class="con-cuxiao coupons">
<view class="cuxiao-title">可领优惠券</view> <view class="cuxiao-title">可领优惠券</view>
<PromotionCoupon @getCoupon="getCoupon" :res="PromotionList" /> <PromotionCoupon @getCoupon="getCoupon" :res="PromotionList" />
</view> </view>
@ -225,13 +327,29 @@
</u-popup> </u-popup>
<!-- 配送地址弹窗 --> <!-- 配送地址弹窗 -->
<popupAddress @closeAddress="closePopupAddress" @deliveryData="deliveryFun" v-if="goodsDetail.id" <popupAddress
:goodsId="goodsDetail.id" :addressFlag="addressFlag" /> @closeAddress="closePopupAddress"
@deliveryData="deliveryFun"
v-if="goodsDetail.id"
:goodsId="goodsDetail.id"
:addressFlag="addressFlag"
/>
<!-- 商品规格 商品详情以及默认参与活动的id--> <!-- 商品规格 商品详情以及默认参与活动的id-->
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy" <popupGoods
@queryCart="cartCount()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :id="productId" :addr="delivery"
v-if="goodsDetail.id " :pointDetail="pointDetail" @handleClickSku="selectSku" :buyMask="buyMask" /> ref="popupGoods"
@changed="changedGoods"
@closeBuy="closePopupBuy"
@queryCart="cartCount()"
:goodsDetail="goodsDetail"
:goodsSpec="goodsSpec"
:id="productId"
v-if="goodsDetail.id"
:pointDetail="pointDetail"
@handleClickSku="selectSku"
:buyMask="buyMask"
/>
</view> </view>
</view> </view>
</div> </div>
@ -239,12 +357,7 @@
<script> <script>
/************接口API***************/ /************接口API***************/
import { import { getGoods, getGoodsList, getMpScene, getGoodsDistribution } from "@/api/goods.js";
getGoods,
getGoodsList,
getMpScene,
getGoodsDistribution,
} from "@/api/goods.js";
import * as API_trade from "@/api/trade.js"; import * as API_trade from "@/api/trade.js";
import * as API_Members from "@/api/members.js"; import * as API_Members from "@/api/members.js";
import * as API_store from "@/api/store.js"; import * as API_store from "@/api/store.js";
@ -473,16 +586,11 @@ export default {
getMpScene(this.routerVal.scene).then((res) => { getMpScene(this.routerVal.scene).then((res) => {
if (res.data.success) { if (res.data.success) {
let data = res.data.result.split(","); // skuId,goodsId,distributionId let data = res.data.result.split(","); // skuId,goodsId,distributionId
console.warn(data);
this.init(data[0], data[1], data[2]); this.init(data[0], data[1], data[2]);
} }
}); });
} else { } else {
this.init( this.init(this.routerVal.id, this.routerVal.goodsId, this.routerVal.distributionId);
this.routerVal.id,
this.routerVal.goodsId,
this.routerVal.distributionId
);
} }
}, },
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
@ -530,7 +638,6 @@ export default {
let response = await getGoods(id, goodsId); let response = await getGoods(id, goodsId);
console.log(response);
if (!response.data.success) { if (!response.data.success) {
setTimeout(() => { setTimeout(() => {
uni.navigateBack(); uni.navigateBack();
@ -540,7 +647,6 @@ export default {
if (distributionId || this.$store.state.distributionId) { if (distributionId || this.$store.state.distributionId) {
let disResult = await getGoodsDistribution(distributionId); let disResult = await getGoodsDistribution(distributionId);
if (!disResult.data.success || disResult.statusCode == 403) { if (!disResult.data.success || disResult.statusCode == 403) {
console.log("绑定成功!");
this.$store.state.distributionId = distributionId; this.$store.state.distributionId = distributionId;
} }
} }
@ -749,7 +855,6 @@ export default {
category: this.goodsDetail.categoryId, category: this.goodsDetail.categoryId,
keyword: this.goodsDetail.name, keyword: this.goodsDetail.name,
}).then((res) => { }).then((res) => {
console.warn(this.likeGoodsList )
this.likeGoodsList = res.data.result.content; this.likeGoodsList = res.data.result.content;
}); });
}, },

View File

@ -4,12 +4,21 @@
<view class="goods-detail"> <view class="goods-detail">
<view class="detail_padding"> <view class="detail_padding">
<div class="goods-detail-box"> <div class="goods-detail-box">
<div class="goods-detail-item goods-active">商品介绍 <div class="goods-detail-item goods-active">商品介绍</div>
</div>
</div> </div>
<u-empty class="empty" text="暂无商品介绍" mode="data" v-if="!res.mobileIntro"></u-empty> <u-empty
<u-parse class="vhtml" :lazy-load="true" :use-cache="true" :show-with-animation="true" class="empty"
:html="res.mobileIntro"></u-parse> text="暂无商品介绍"
mode="data"
v-if="!res.mobileIntro"
></u-empty>
<u-parse
class="vhtml"
:lazy-load="true"
:use-cache="true"
:show-with-animation="true"
:html="res.mobileIntro"
></u-parse>
</view> </view>
</view> </view>
</view> </view>
@ -24,12 +33,22 @@
<div class="param-list" v-if="goodsParams.length == 0"> <div class="param-list" v-if="goodsParams.length == 0">
<u-empty text="暂无商品参数" mode="list"></u-empty> <u-empty text="暂无商品参数" mode="list"></u-empty>
</div> </div>
<div class="params-group" v-for="(group,groupIndex) in goodsParams" :key="groupIndex"> <div
<view style="font-weight: bold;margin-left: 10px;">{{group.groupName}}</view> class="params-group"
v-for="(group, groupIndex) in goodsParams"
:key="groupIndex"
>
<view style="font-weight: bold; margin-left: 10px">{{
group.groupName
}}</view>
<div class="param-list"> <div class="param-list">
<div class="param-item" v-for="(param,index) in group.goodsParamsItemDTOList" :key="index"> <div
<div class="param-left">{{param.paramName}}</div> class="param-item"
<div class="param-right">{{param.paramValue}}</div> v-for="(param, index) in group.goodsParamsItemDTOList"
:key="index"
>
<div class="param-left">{{ param.paramName }}</div>
<div class="param-right">{{ param.paramValue }}</div>
</div> </div>
</div> </div>
</div> </div>
@ -49,7 +68,6 @@ export default {
}, },
props: ["res", "goodsId", "goodsParams"], props: ["res", "goodsId", "goodsParams"],
async mounted() { async mounted() {
console.log(this.res);
let res = await getGoodsMessage(this.goodsId); let res = await getGoodsMessage(this.goodsId);
if (res.data.success) { if (res.data.success) {
this.goodsDetail = res.data.result; this.goodsDetail = res.data.result;
@ -131,11 +149,7 @@ export default {
width: 52rpx; width: 52rpx;
height: 6rpx; height: 6rpx;
background-image: linear-gradient( background-image: linear-gradient(90deg, $price-color, $price-light-color);
90deg,
$price-color,
$price-light-color
);
} }
} }
> .goods-detail-item { > .goods-detail-item {

View File

@ -1,23 +1,23 @@
<template> <template>
<view class="group-list"> <view class="group-list">
<view class="group-name">拼购列表</view> <view class="group-name">拼购列表</view>
<view v-if="assembleOrder.length !=0"> <view v-if="assembleOrder.length != 0">
<view class="group-item" v-for="(order,index) in assembleOrder" :key="index"> <view class="group-item" v-for="(order, index) in assembleOrder" :key="index">
<view class="group-item-user"> <view class="group-item-user">
<u-image shape="circle" width="40px" height="40px" :src="order.face"></u-image> <u-image shape="circle" width="40px" height="40px" :src="order.face"></u-image>
<span class="group-item-name">{{order.nickName | noPassByName}}</span> <span class="group-item-name">{{ order.nickName | noPassByName }}</span>
</view> </view>
<view> <view>
<span class="group-item-name">还差{{ order.toBeGroupedNum}}人成团</span> <span class="group-item-name">还差{{ order.toBeGroupedNum }}人成团</span>
</view> </view>
<view> <view>
<u-button size="mini" :custom-style="customStyle" @click="buy(order)"></u-button> <u-button size="mini" :custom-style="customStyle" @click="buy(order)"
>去参团</u-button
>
</view> </view>
</view> </view>
</view> </view>
<view v-else class="nomore"> <view v-else class="nomore">
<u-empty text="暂无拼团信息" mode="list"></u-empty> <u-empty text="暂无拼团信息" mode="list"></u-empty>
</view> </view>
</view> </view>

View File

@ -1,61 +1,105 @@
<template> <template>
<view> <view>
<div v-for="(promotion, promotion_index) in res" :key="promotion_index"> <div v-for="(promotion, promotion_index) in res" :key="promotion_index">
<div class="showBox" v-if="promotion.__key == 'SECKILL' || promotion.__key =='GROUPBUY' || promotion.__key == 'PINTUAN'"> <div
class="showBox"
v-if="
promotion.__key == 'SECKILL' ||
promotion.__key == 'GROUPBUY' ||
promotion.__key == 'PINTUAN'
"
>
<view class="group-wrapper"> <view class="group-wrapper">
<div class="u-group-row"> <div class="u-group-row">
<view :span="8" class="showBox_L"> <view :span="8" class="showBox_L">
<view class="u-group-flex"> <view class="u-group-flex">
<!-- 限时抢购 --> <!-- 限时抢购 -->
<view class="u-group-flex-left" v-if="promotion.__key == 'SECKILL' "> <view class="u-group-flex-left" v-if="promotion.__key == 'SECKILL'">
<span
<span class="u-group-flex-left-span" v-if="detail.promotionPrice!=undefined"> class="u-group-flex-left-span"
<span class="flex-price"> {{ formatPrice(detail.promotionPrice)[0]}}.{{ formatPrice(detail.promotionPrice)[1]}}</span> v-if="detail.promotionPrice != undefined"
>
<span class="flex-price">
{{ formatPrice(detail.promotionPrice)[0] }}.{{
formatPrice(detail.promotionPrice)[1]
}}</span
>
</span> </span>
<view class="u-group-flex" v-if="detail.price!=undefined"> <view class="u-group-flex" v-if="detail.price != undefined">
<span class="old-price">{{ formatPrice(detail.price)[0]}}.{{ formatPrice(detail.price)[1]}}</span> <span class="old-price"
>{{ formatPrice(detail.price)[0] }}.{{
formatPrice(detail.price)[1]
}}</span
>
<view class="promotion">限时抢购</view> <view class="promotion">限时抢购</view>
</view> </view>
</view> </view>
<!-- 团购 --> <!-- 团购 -->
<view class="u-group-flex-left" v-if="promotion.__key == 'GROUPBUY' "> <view class="u-group-flex-left" v-if="promotion.__key == 'GROUPBUY'">
<span class="u-group-flex-left-span"> <span class="u-group-flex-left-span">
<span class="flex-price" <span
v-if="promotion.groupbuy_goods_vo.price !=undefined">{{ formatPrice(promotion.groupbuy_goods_vo.price )[0]}}.{{ formatPrice(promotion.groupbuy_goods_vo.price )[1]}}</span> class="flex-price"
v-if="promotion.groupbuy_goods_vo.price != undefined"
>{{ formatPrice(promotion.groupbuy_goods_vo.price)[0] }}.{{
formatPrice(promotion.groupbuy_goods_vo.price)[1]
}}</span
>
<!-- <span v-if="promotion.point">+{{promotion.point}}</span> --> <!-- <span v-if="promotion.point">+{{promotion.point}}</span> -->
</span> </span>
<view class="u-group-flex"> <view class="u-group-flex">
<span class="old-price" <span
v-if="promotion.groupbuy_goods_vo.original_price!=undefined">{{ formatPrice(promotion.groupbuy_goods_vo.original_price)[0]}}.{{ formatPrice(promotion.groupbuy_goods_vo.original_price)[1]}}</span> class="old-price"
v-if="promotion.groupbuy_goods_vo.original_price != undefined"
>{{
formatPrice(promotion.groupbuy_goods_vo.original_price)[0]
}}.{{
formatPrice(promotion.groupbuy_goods_vo.original_price)[1]
}}</span
>
<view class="promotion">团购活动</view> <view class="promotion">团购活动</view>
</view> </view>
</view> </view>
<view class="u-group-flex-left" v-if="promotion.__key == 'PINTUAN' "> <view class="u-group-flex-left" v-if="promotion.__key == 'PINTUAN'">
<span
<span class="u-group-flex-left-span" v-if="detail.promotionPrice != undefined"> class="u-group-flex-left-span"
<span class="flex-price"> {{ formatPrice(detail.promotionPrice)[0]}}.</span>{{ formatPrice(detail.promotionPrice)[1]}} v-if="detail.promotionPrice != undefined"
>
<span class="flex-price">
{{ formatPrice(detail.promotionPrice)[0] }}.</span
>{{ formatPrice(detail.promotionPrice)[1] }}
</span> </span>
<view class="u-group-flex" v-if="detail.price != undefined"> <view class="u-group-flex" v-if="detail.price != undefined">
<span class="old-price">{{ formatPrice(detail.price)[0]}}.{{ formatPrice(detail.price)[1]}}</span> <span class="old-price"
>{{ formatPrice(detail.price)[0] }}.{{
formatPrice(detail.price)[1]
}}</span
>
<view class="promotion">拼团活动</view> <view class="promotion">拼团活动</view>
</view> </view>
</view> </view>
<!-- 拼团右侧 --> <!-- 拼团右侧 -->
<view class="u-group-flex-right" v-if="promotion.__key == 'PINTUAN' "> <view class="u-group-flex-right" v-if="promotion.__key == 'PINTUAN'">
<span class="group-bag">{{promotion.requiredNum}}人拼团 </span> <span class="group-bag">{{ promotion.requiredNum }}人拼团 </span>
<span class="group-bag">限购{{promotion.limitNum}}</span> <span class="group-bag">限购{{ promotion.limitNum }}</span>
</view> </view>
</view> </view>
</view> </view>
<view class="showBox_R" v-if="promotion && promotion.endTime"> <view class="showBox_R" v-if="promotion && promotion.endTime">
<u-tag :text="getIsTimer(promotion)" size="mini" type="error" /> <u-tag :text="getIsTimer(promotion)" size="mini" type="error" />
<u-count-down :hide-zero-day="true" font-size="25" color="#fff" bg-color="#f71471" separator-size="25" separator-color="#f71471" :show-hours="true" :show-minutes="true" <u-count-down
:timestamp="getCountDownTime(promotion.endTime)"></u-count-down> :hide-zero-day="true"
font-size="25"
color="#fff"
bg-color="#f71471"
separator-size="25"
separator-color="#f71471"
:show-hours="true"
:show-minutes="true"
:timestamp="getCountDownTime(promotion.endTime)"
></u-count-down>
</view> </view>
</div> </div>
</view> </view>
@ -105,13 +149,12 @@ export default {
return val.toFixed(2).split("."); return val.toFixed(2).split(".");
}, },
getCountDownTime(val) { getCountDownTime(val) {
let date = new Date(val.replace(/-/g, "/")) let date = new Date(val.replace(/-/g, "/"));
let timeSimple = new Date(date).getTime() / 1000; let timeSimple = new Date(date).getTime() / 1000;
return timeSimple - new Date().getTime() / 1000; return timeSimple - new Date().getTime() / 1000;
}, },
getIsTimer(val) { getIsTimer(val) {
var timestamp = new Date().getTime(); var timestamp = new Date().getTime();
if (timestamp < val.start_time) { if (timestamp < val.start_time) {
this.startTimer = true; this.startTimer = true;

View File

@ -1,33 +1,37 @@
<template> <template>
<view class="wrapper"> <view class="wrapper">
<div class="coupon-empty" v-if="!res"></div> <div class="coupon-empty" v-if="!res"></div>
<view class="coupon-List" v-if="res && item.__key=='COUPON'" v-for="(item, index) in res" :key="index"> <view class="coupon-List" v-for="(item, index) in couponRes" :key="index">
<view class="coupon-item"> <view class="coupon-item">
<view class="top"> <view class="top">
<div class="price"> <div class="price">
<span v-if="item.couponType == 'DISCOUNT'">{{ item.couponDiscount }}</span> <span v-if="item.couponType == 'DISCOUNT'">{{ item.couponDiscount }}</span>
<span v-if="item.couponType == 'PRICE'">{{ item.price | unitPrice }}</span> <span v-if="item.couponType == 'PRICE'">{{ item.price | unitPrice }}</span>
</div> </div>
<view class="text"> <view class="text">
<div class="coupon-List-title"> <div class="coupon-List-title">
<view v-if="item.scopeType"> <view v-if="item.scopeType">
<span v-if="item.scopeType == 'ALL' && item.id == 'platform'"></span> <span v-if="item.scopeType == 'ALL' && item.id == 'platform'"
>全平台</span
>
<span v-if="item.scopeType == 'PORTION_CATEGORY'"></span> <span v-if="item.scopeType == 'PORTION_CATEGORY'"></span>
<view v-else>{{ item.storeName == 'platform' ? '' :item.storeName+'' }}使</view> <view v-else
>{{
item.storeName == "platform" ? "全平台" : item.storeName + "店铺"
}}使用</view
>
</view> </view>
</div> </div>
<div>{{ item.consumeThreshold | unitPrice }}可用</div> <div>{{ item.consumeThreshold | unitPrice }}可用</div>
</view> </view>
<view class="lingqu-btn" @click="getCoupon(item)"> <view class="lingqu-btn" @click="getCoupon(item, index)">
<div :class="yhqFlag ? 'cur' : ''">{{ yhqFlag ? '已领取或领完' : '立即领取' }}</div> <div :class="yhqFlag[index] ? 'cur' : ''">
{{ yhqFlag[index] ? "已领取或领完" : "立即领取" }}
</div>
</view> </view>
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="time">{{ item.startTime }} - {{item.endTime }}</view> <view class="time">{{ item.startTime }} - {{ item.endTime }}</view>
</view> </view>
</view> </view>
</view> </view>
@ -37,7 +41,8 @@
export default { export default {
data() { data() {
return { return {
yhqFlag: false, // yhqFlag: [], //
couponRes: {},
}; };
}, },
props: { props: {
@ -52,7 +57,9 @@ export default {
if (this.res && this.res.length != 0) { if (this.res && this.res.length != 0) {
Object.keys(this.res).forEach((item) => { Object.keys(this.res).forEach((item) => {
let key = item.split("-")[0]; let key = item.split("-")[0];
this.res[item].__key = key; if (key === "COUPON") {
this.couponRes[item] = this?.res[item];
}
}); });
} }
}, },
@ -61,9 +68,8 @@ export default {
}, },
methods: { methods: {
// //
getCoupon(item) { getCoupon(item, index) {
this.yhqFlag = true; this.yhqFlag[index] = true;
this.$emit("getCoupon", item); this.$emit("getCoupon", item);
}, },
}, },

View File

@ -1,50 +1,65 @@
<template> <template>
<view> <view>
<view
<view v-for="(promotionItem,promotionIndex) in promotion" :key="promotionIndex" class="promotion_row" @click="shutMask(1)"> v-for="(promotionItem, promotionIndex) in promotion"
<view v-if="res!=null" v-for="(item, index) in Object.keys(res)" :key="index"> :key="promotionIndex"
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'FULL_DISCOUNT'"> class="promotion_row"
@click="shutMask(1)"
>
<view v-if="res != null" v-for="(item, index) in Object.keys(res)" :key="index">
<div
class="promotion_col"
v-if="
item.split('-')[0] == promotionItem.value &&
item.split('-')[0] == 'FULL_DISCOUNT'
"
>
<!-- 满减折扣 --> <!-- 满减折扣 -->
<div class="flex"> <div class="flex">
<view class="deg_tag">{{promotionItem.title}}</view> <view class="deg_tag">{{ promotionItem.title }}</view>
<div class="text proText">{{ res[item].fullMoney }}立享优惠</div> <div class="text proText">{{ res[item].fullMoney }}立享优惠</div>
</div> </div>
</div> </div>
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'PINTUAN'"> <div
class="promotion_col"
v-if="
item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'PINTUAN'
"
>
<!-- 拼团 --> <!-- 拼团 -->
<div class="flex"> <div class="flex">
<view class="deg_tag">{{promotionItem.title}}</view> <view class="deg_tag">{{ promotionItem.title }}</view>
<div class="text proText">{{ res[item].promotionName }}</div> <div class="text proText">{{ res[item].promotionName }}</div>
</div> </div>
</div> </div>
<div class="promotion_col" v-if="item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'SECKILL'"> <div
class="promotion_col"
v-if="
item.split('-')[0] == promotionItem.value && item.split('-')[0] == 'SECKILL'
"
>
<!-- 限时抢购 --> <!-- 限时抢购 -->
<div class="flex"> <div class="flex">
<view class="deg_tag">{{promotionItem.title}}</view> <view class="deg_tag">{{ promotionItem.title }}</view>
<div class="text proText">{{ res[item].promotionName }}</div> <div class="text proText">{{ res[item].promotionName }}</div>
</div> </div>
</div> </div>
</view> </view>
<view class="promotion_row" style="display:inline;"> <view class="promotion_row" style="display: inline">
<view> <view>
<div class="promotion_col coupon" v-if="couponList && promotionIndex ==1"> <div class="promotion_col coupon" v-if="couponList && promotionIndex == 1">
<!-- 优惠券 --> <!-- 优惠券 -->
<div> <div>
<view class="deg_tag">优惠券</view> <view class="deg_tag">优惠券</view>
</div> </div>
</div> </div>
</view> </view>
</view> </view>
</view> </view>
<view v-if=" this.res != null && Object.keys(res).length == 0"> <view v-if="this.res != null && Object.keys(res).length == 0"> </view>
暂无促销信息
</view>
</view> </view>
</template> </template>
@ -69,7 +84,6 @@ export default {
handler() { handler() {
if (this.res && this.res.length != 0 && this.res != null) { if (this.res && this.res.length != 0 && this.res != null) {
Object.keys(this.res).forEach((item) => { Object.keys(this.res).forEach((item) => {
let key = item.split("-")[0]; let key = item.split("-")[0];
this.res[item].__key = key; this.res[item].__key = key;

View File

@ -26,7 +26,7 @@
<div v-if="groupBuy.length !=0"> <div v-if="groupBuy.length !=0">
<view class="view-item" v-for="(groupItem, groupIndex) in groupBuy" :key="groupIndex"> <view class="view-item" v-for="(groupItem, groupIndex) in groupBuy" :key="groupIndex">
<view class="view-left"> <view class="view-left">
<u-image border-radius="10" shape="square" :src="groupItem.goodsImage" width="186rpx" height="186rpx"> <u-image border-radius="10" shape="square" :src="groupItem.thumbnail" width="186rpx" height="186rpx">
<view slot="error" style="font-size: 24rpx;">加载失败</view> <view slot="error" style="font-size: 24rpx;">加载失败</view>
</u-image> </u-image>