Commit 5992ad52 authored by 黄媛媛's avatar 黄媛媛

代码格式化

parent 682d2acb
<template> <template>
<view class="goods"> <view class="goods">
<view class="u-skeleton" v-if="isExsitGoods"> <view class="u-skeleton" v-if="isExsitGoods">
<view class="u-skeleton-rect"> <view class="u-skeleton-rect">
<u-swiper <u-swiper :list="g.pic_url" height="100" unit="vw" :interval="10000" name="pic_url" :border-radius="0" @click="previewImage"></u-swiper>
:list="g.pic_url" <!-- TODO 分销价格未做 is_share_price -->
height="100" <view class="is_share" v-if="g.share > 0" style="top:240px;">
unit="vw" <image src="@/static/images/icon/WechatIMG424.png" style="width: 20px; margin-left: 12px; opacity: 1;height: auto;" mode="widthFix" />
:interval="10000" <view
name="pic_url" style="
:border-radius="0"
@click="previewImage"
></u-swiper>
<!-- TODO 分销价格未做 is_share_price -->
<view class="is_share" v-if="g.share > 0" style="top:240px;">
<image
src="@/static/images/icon/WechatIMG424.png"
style="width: 20px; margin-left: 12px; opacity: 1;height: auto;"
mode="widthFix"
/>
<view
style="
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: 8px; margin-left: 8px;
...@@ -27,19 +15,15 @@ ...@@ -27,19 +15,15 @@
color: #fff; color: #fff;
opacity: 1; opacity: 1;
" "
> >
<Text>分销最高可赚</Text> <Text>分销最高可赚</Text>
<Text>{{ g.share }}</Text> <Text>{{ g.share }}</Text>
</view> </view>
</view> </view>
<view class="is_share" v-if="g.myBuyCommission>0"> <view class="is_share" v-if="g.myBuyCommission > 0">
<image <image src="@/static/images/icon/WechatIMG424.png" style="width: 20px; margin-left: 12px; opacity: 1;" mode="widthFix" />
src="@/static/images/icon/WechatIMG424.png" <view
style="width: 20px; margin-left: 12px; opacity: 1;" style="
mode="widthFix"
/>
<view
style="
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: 8px; margin-left: 8px;
...@@ -47,867 +31,745 @@ ...@@ -47,867 +31,745 @@
color: #fff; color: #fff;
opacity: 1; opacity: 1;
" "
> >
<Text>自购最高返利</Text> <Text>自购最高返利</Text>
<Text>{{ g.myBuyCommission }}</Text> <Text>{{ g.myBuyCommission }}</Text>
</view> </view>
</view> </view>
</view>
<view class="g-info">
<view class="g-name u-skeleton-rect">{{ g.name }}</view>
<view class="g-price-box">
<view class="left">
<view class="price u-skeleton-rect" :style="{ color: mc }">
<text class="small"></text>
<text class="numfont">
{{
g.price_min == g.price_max
? g.price_min
: g.price_min + "-" + g.price_max
}}
</text>
</view>
<!-- TODO is_common_user_member_price 普通用户会员价 -->
<!-- TODO is_member_user_member_price 会员用户会员价 -->
<view class="sell u-skeleton-rect">
<text class="oprice" v-if="setting.is_underline_price == 1">
{{ g.original_price }}
</text>
<text v-if="setting.is_sales == 1"
>已售出{{ g.sales }}{{ g.unit }}</text
>
</view>
</view>
<view class="right u-skeleton-rect" @click="openShare" v-if="isAllowShare==1">
<image
src="@/static/images/icon/icon-share.png"
class="share-icon"
/>
<text>分享</text>
</view>
</view>
</view>
<view
class="sku-box u-skeleton-rect"
style="align-items: flex-start;"
>
<view class="label" style="margin-top: 5px;" >活动</view>
<view class="content" style="display: flex;flex-direction: column" >
<view style="display: flex;flex-direction: row;align-items: center;margin-bottom: 5px;" v-if="g.goods_marketing_award.integral.title != ''">
<u-tag text="送积分" type="error" />
<text style="margin-left: 5px; font-size: 12px;">{{
g.goods_marketing_award.integral.title
}}</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center" v-if="g.goods_marketing_award.PresentFXGradeMsg != ''" @click="goVIP">
<u-tag text="送会员" type="error" />
<text style="margin-left: 5px; font-size: 12px;">{{
g.goods_marketing_award.PresentFXGradeMsg
}}</text>
</view> </view>
<view class="g-info">
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 5px;" @click="goUrl(g.FreeShippingUrl)" <view class="g-name u-skeleton-rect">{{ g.name }}</view>
v-if=" g.freeShippingName!=null && g.freeShippingName !='' &&(g.fullMoneyPinkage > 0 || g.fullNumPinkage>0)" <view class="g-price-box">
> <view class="left">
<view style="color: #fa3534;background: #fef0f0;padding: 12rpx 22rpx; font-size: 22rpx;margin-right: 5px;border: 1px solid #fde2e2;border-radius: 6rpx;"> <view class="price u-skeleton-rect" :style="{ color: mc }">
{{g.freeShippingName !=null ?g.freeShippingName:''}} <text class="small"></text>
<text class="numfont">{{ g.price_min == g.price_max ? g.price_min : g.price_min + '-' + g.price_max }}</text>
</view>
<!-- TODO is_common_user_member_price 普通用户会员价 -->
<!-- TODO is_member_user_member_price 会员用户会员价 -->
<view class="sell u-skeleton-rect">
<text class="oprice" v-if="setting.is_underline_price == 1">{{ g.original_price }}</text>
<text v-if="setting.is_sales == 1">已售出{{ g.sales }}{{ g.unit }}</text>
</view>
</view>
<view class="right u-skeleton-rect" @click="openShare" v-if="isAllowShare == 1">
<image src="@/static/images/icon/icon-share.png" class="share-icon" />
<text>分享</text>
</view>
</view> </view>
</view>
{{g.fullMoneyPinkage>0 && g.fullNumPinkage==0?g.fullMoneyPinkage+'元包邮':''}} <view class="sku-box u-skeleton-rect" style="align-items: flex-start;">
{{g.fullMoneyPinkage==0 && g.fullNumPinkage>0?g.fullNumPinkage+'件包邮':''}} <view class="label" style="margin-top: 5px;">活动</view>
</view> <view class="content" style="display: flex;flex-direction: column">
<view style="display: flex;flex-direction: row;align-items: center;margin-bottom: 5px;" v-if="g.goods_marketing_award.integral.title != ''">
<u-tag text="送积分" type="error" />
<!-- <view style="margin-top: 5px;" v-if=" <text style="margin-left: 5px; font-size: 12px;">{{ g.goods_marketing_award.integral.title }}</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center" v-if="g.goods_marketing_award.PresentFXGradeMsg != ''" @click="goVIP">
<u-tag text="送会员" type="error" />
<text style="margin-left: 5px; font-size: 12px;">{{ g.goods_marketing_award.PresentFXGradeMsg }}</text>
</view>
<view
style="display: flex;flex-direction: row;align-items: center;margin-top: 5px;"
@click="goUrl(g.FreeShippingUrl)"
v-if="g.freeShippingName != null && g.freeShippingName != '' && (g.fullMoneyPinkage > 0 || g.fullNumPinkage > 0)"
>
<view style="color: #fa3534;background: #fef0f0;padding: 12rpx 22rpx; font-size: 22rpx;margin-right: 5px;border: 1px solid #fde2e2;border-radius: 6rpx;">
{{ g.freeShippingName != null ? g.freeShippingName : '' }}
</view>
{{ g.fullMoneyPinkage > 0 && g.fullNumPinkage == 0 ? g.fullMoneyPinkage + '元包邮' : '' }}
{{ g.fullMoneyPinkage == 0 && g.fullNumPinkage > 0 ? g.fullNumPinkage + '件包邮' : '' }}
</view>
<!-- <view style="margin-top: 5px;" v-if="
g.goods_marketing_award.PresentFXGradeMsg == '' g.goods_marketing_award.PresentFXGradeMsg == ''
&& g.goods_marketing_award.integral.title == '' && && g.goods_marketing_award.integral.title == '' &&
g.freeShippingName!=null && g.freeShippingName !='' &&(g.fullMoneyPinkage == 0 && g.fullNumPinkage==0) g.freeShippingName!=null && g.freeShippingName !='' &&(g.fullMoneyPinkage == 0 && g.fullNumPinkage==0)
"> ">
<text>暂无活动</text> <text>暂无活动</text>
</view> --> </view> -->
</view> </view>
</view>
</view> <view class="sku-box u-skeleton-rect" style="align-items: flex-start;" v-if="sku.length > 0">
<view <view class="label">选择</view>
class="sku-box u-skeleton-rect" <view class="content">
style="align-items: flex-start;" <view class="sku-chosen" @click="chosenSku">
v-if="sku.length > 0" <view class="sku">{{ currentSku.attr_list.length > 0 ? '已' : '请' }}选择 {{ sku }}</view>
> <view class="arrow"><u-icon name="arrow" :size="32" color="#111"></u-icon></view>
<view class="label">选择</view> </view>
<view class="content"> <view class="suk-item" style="flex-wrap: wrap;">
<view class="sku-chosen" @click="chosenSku"> <template v-if="skuimage.length > 0">
<view class="sku" <view v-for="(x, i) in skuimage" class="item img" style="margin-bottom: 5px;" :key="i"><image :src="x" style="width: 100%; height: 100%;" /></view>
>{{ currentSku.attr_list.length > 0 ? "已" : "请" }}选择 <view class="item" v-if="g.attr_groups[0].attr_list.length > 1">
{{ sku }}</view {{ g.attr_groups[0].attr_list.length }}{{ g.attr_groups[0].attr_group_name }}可选
> </view>
<view class="arrow"> </template>
<u-icon name="arrow" :size="32" color="#111"></u-icon> <template v-else>
</view> <template v-for="(x, i) in g.attr_groups[0].attr_list">
</view> <view class="item" v-if="i < 5" :key="i" style="margin-bottom: 5px;">{{ x.attr_name }}</view>
<view class="suk-item" style="flex-wrap: wrap;"> </template>
<template v-if="skuimage.length > 0">
<view
v-for="(x, i) in skuimage"
class="item img"
style="margin-bottom: 5px;"
:key="i"
>
<image :src="x" style="width: 100%; height: 100%;" />
</view>
<view class="item" v-if="g.attr_groups[0].attr_list.length > 1">
{{ g.attr_groups[0].attr_list.length }}{{
g.attr_groups[0].attr_group_name
}}可选
</view>
</template>
<template v-else>
<template v-for="(x, i) in g.attr_groups[0].attr_list">
<view
class="item"
v-if="i < 5"
:key="i"
style="margin-bottom: 5px;"
>{{ x.attr_name }}</view
>
</template>
<view class="item" v-if="g.attr_groups[0].attr_list.length > 1"> <view class="item" v-if="g.attr_groups[0].attr_list.length > 1">
共{{ g.attr_groups[0].attr_list.length }}种{{ 共{{ g.attr_groups[0].attr_list.length }}种{{ g.attr_groups[0].attr_group_name }}可选
g.attr_groups[0].attr_group_name </view>
}}可选 </template>
</view> </view>
</template> </view>
</view> </view>
</view>
</view>
<view class="sku-box u-skeleton-rect" v-if="setting.is_express == '1' "> <view class="sku-box u-skeleton-rect" v-if="setting.is_express == '1'">
<view class="label">快递</view> <view class="label">快递</view>
<view class="content">{{ <view class="content">{{ g.express == '' ? '免运费' : '¥' + g.express }}</view>
g.express == "" ? "免运费" : "¥" + g.express </view>
}}</view>
</view> <view class="sku-box u-skeleton-rect" style="margin-top: -10;" v-if="g.goods_marketing.shipping != ''">
<view class="label">包邮</view>
<view <view class="content">{{ g.goods_marketing.shipping }}</view>
class="sku-box u-skeleton-rect" </view>
style="margin-top: -10;" <view class="sku-box u-skeleton-rect" style="margin-top: -10;" v-if="g.goods_marketing.limit != ''">
v-if="g.goods_marketing.shipping != ''" <view class="label">限购</view>
> <view class="content">{{ g.goods_marketing.limit }}</view>
<view class="label">包邮</view> </view>
<view class="content">{{ g.goods_marketing.shipping }}</view>
</view>
<view
class="sku-box u-skeleton-rect"
style="margin-top: -10;"
v-if="g.goods_marketing.limit != ''"
>
<view class="label">限购</view>
<view class="content">{{ g.goods_marketing.limit }}</view>
</view>
<view <view class="sku-box u-skeleton-rect" v-if="comments.length == 0 && setting.is_comment == 1"><view class="label">暂无评论信息</view></view>
class="sku-box u-skeleton-rect" <view class="comment" v-if="comments.length > 0">
v-if="comments.length == 0 && setting.is_comment == 1" <view class="chead">
> <u-section
<view class="label">暂无评论信息</view> :bold="false"
</view> :sub-color="secondary"
<view class="comment" v-if="comments.length > 0"> :show-split="false"
<view class="chead"> :title="`商品评价(${comments.length})`"
<u-section sub-title="查看更多"
:bold="false" @click="clickCommentHandler"
:sub-color="secondary" font-size="24"
:show-split="false" ></u-section>
:title="`商品评价(${comments.length})`" </view>
sub-title="查看更多" <view class="content">
@click="clickCommentHandler" <view class="u-box">
font-size="24" <view class="user">
></u-section> <u-avatar :src="comments[0].UserPhotoPath" :size="50"></u-avatar>
</view> <text style="margin-left: 10px;">{{ comments[0].UserName }}</text>
<view class="content"> </view>
<view class="u-box"> <view class="timer">{{ comments[0].CreateDate }}</view>
<view class="user"> </view>
<u-avatar :src="comments[0].UserPhotoPath" :size="50"></u-avatar> <view class="ucontent">{{ comments[0].Content }}</view>
<text style="margin-left: 10px;"> </view>
{{ comments[0].UserName }} </view>
</text> <u-divider :margin-top="20" :margin-bottom="20" bg-color="transparent">商品详情</u-divider>
</view> <view class="details">
<view class="timer">{{ comments[0].CreateDate }}</view> <!-- <rich-text :nodes="detailContent" @click="clickDescription"></rich-text> -->
</view> <h-parse :content="detailContent" @navigate="clickDescription"></h-parse>
<view class="ucontent">{{ comments[0].Content }}</view> </view>
</view> <u-divider :margin-top="20" :margin-bottom="20" bg-color="transparent">或许你喜欢</u-divider>
</view> <view style="width: calc(100vw - 20px); margin-left: 10px; overflow: hidden;"><goodlist :list="recommend"></goodlist></view>
<u-divider :margin-top="20" :margin-bottom="20" bg-color="transparent"
>商品详情</u-divider
>
<view class="details">
<!-- <rich-text :nodes="detailContent" @click="clickDescription"></rich-text> -->
<h-parse
:content="detailContent"
@navigate="clickDescription"
></h-parse>
</view>
<u-divider :margin-top="20" :margin-bottom="20" bg-color="transparent"
>或许你喜欢</u-divider
>
<view
style="width: calc(100vw - 20px); margin-left: 10px; overflow: hidden;"
>
<goodlist :list="recommend"></goodlist>
</view>
<u-skeleton <u-skeleton v-if="loading" :loading="true" :animation="true" bgcolor="#FFF"></u-skeleton>
v-if="loading" <goodsaction v-if="!loading" :good-name="g.name" :cover-pic="g.cover_pic" :favorite="g.favorite" :good-id="id" @join-car="joinCar" @buy="buy"></goodsaction>
:loading="true" <goodsku
:animation="true" v-if="!loading && showSku"
bgcolor="#FFF" border-radius="10"
></u-skeleton> v-model="showSku"
<goodsaction :mask-close-able="true"
v-if="!loading" :safe-area-inset-bottom="true"
:good-name="g.name" :good="g"
:cover-pic="g.cover_pic" :option-type="ot"
:favorite="g.favorite" :skued="currentSku"
:good-id="id" @close="closeSkuChosen"
@join-car="joinCar" ></goodsku>
@buy="buy" </view>
></goodsaction> <u-empty text="没有找到商品,或商品已下架" mode="favor" v-if="!isExsitGoods"></u-empty>
<goodsku <share :good-id="id" v-if="showShare" :good-name="g.name" :images="g.pic_url" :advertising="g.advertising" @close="closeShare"></share>
v-if="!loading && showSku" <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
border-radius="10" <coupon v-if="showCoupons" :coupon-message="couponMessage" @goLook="goLook" @closeBtn="closeBtn"></coupon>
v-model="showSku" </view>
:mask-close-able="true"
:safe-area-inset-bottom="true"
:good="g"
:option-type="ot"
:skued="currentSku"
@close="closeSkuChosen"
></goodsku>
</view>
<u-empty
text="没有找到商品,或商品已下架"
mode="favor"
v-if="!isExsitGoods"
></u-empty>
<share
:good-id="id"
v-if="showShare"
:good-name="g.name"
:images="g.pic_url"
:advertising="g.advertising"
@close="closeShare"
></share>
<auth
v-if="showAuth"
@changeuserinfo="reloadUserinfo"
@gbAuth="gbAuth"
></auth>
<coupon
v-if="showCoupons"
:coupon-message="couponMessage"
@goLook="goLook"
@closeBtn="closeBtn"
></coupon>
</view>
</template> </template>
<script> <script>
// #ifdef APP-NVUE // #ifdef APP-NVUE
const dom = weex.requireModule("dom"); const dom = weex.requireModule('dom');
// #endif // #endif
import goodlist from "@/components/goods/list"; import goodlist from '@/components/goods/list';
import goodsaction from "./components/goodsaction"; import goodsaction from './components/goodsaction';
import goodsku from "@/components/goods/goodsku"; import goodsku from '@/components/goods/goodsku';
import auth from "@/components/auth/index"; import auth from '@/components/auth/index';
import coupon from "@/components/coupons/coupons"; import coupon from '@/components/coupons/coupons';
import share from "./components/share/share"; import share from './components/share/share';
import hParse from "@/components/u-parse/parse.vue"; import hParse from '@/components/u-parse/parse.vue';
export default { export default {
data() { data() {
return { return {
id: 0, id: 0,
loading: true, loading: true,
g: {}, g: {},
imgs: [], imgs: [],
mc: "", mc: '',
sku: "", sku: '',
skuimage: [], skuimage: [],
comments: [], comments: [],
secondary: "", secondary: '',
detailContent: "", detailContent: '',
recommend: [], recommend: [],
showSku: false, showSku: false,
ot: 0, ot: 0,
currentSku: {}, currentSku: {},
isExsitGoods: true, isExsitGoods: true,
pageTitle: "商品详情", pageTitle: '商品详情',
setting: {}, setting: {},
prevPage: "", prevPage: '',
//自定义接手传递 //自定义接手传递
opTionObj: {}, opTionObj: {},
showShare: false, showShare: false,
msg: { msg: {
pageIndex: 1, pageIndex: 1,
pageSize: 20, pageSize: 20,
GoodsId: 0, GoodsId: 0,
CommentGrade: 0, CommentGrade: 0
}, },
showAuth: false, showAuth: false,
showCoupons:false, showCoupons: false,
couponMessage:'', couponMessage: '',
isAllowShare:1, isAllowShare: 1,
u: {}, u: {},
vipState:{}, vipState: {}
}; };
}, },
components: { components: {
goodlist, goodlist,
goodsaction, goodsaction,
goodsku, goodsku,
auth, auth,
coupon, coupon,
share, share,
hParse, hParse
}, },
onLoad(option) { onLoad(option) {
this.opTionObj = option; this.opTionObj = option;
console.log(option,'option'); console.log(option, 'option');
if (option && option.id) { if (option && option.id) {
this.id = option.id ? option.id : 29; //40887 59512 46942 this.id = option.id ? option.id : 29; //40887 59512 46942
} else { } else {
this.id = option.GoodsId ? option.GoodsId : 29; //40887 59512 46942 this.id = option.GoodsId ? option.GoodsId : 29; //40887 59512 46942
}
if(option && option.custom_params){
let custom_params = JSON.parse(decodeURIComponent(option.custom_params))
console.log(custom_params)
if(custom_params.user_id){
uni.setStorageSync("pid", { pid: custom_params.user_id});
} }
} if (option && option.custom_params) {
if (option && option.user_id) { let custom_params = JSON.parse(decodeURIComponent(option.custom_params));
uni.setStorageSync("pid", { pid: option.user_id }); console.log(custom_params);
if (custom_params.user_id) {
} uni.setStorageSync('pid', { pid: custom_params.user_id });
if(uni.getStorageSync("AnchorName")){ //如果有主播名称了先清除 }
}
if (option && option.user_id) {
uni.setStorageSync('pid', { pid: option.user_id });
}
if (uni.getStorageSync('AnchorName')) {
//如果有主播名称了先清除
uni.removeStorageSync('AnchorName'); uni.removeStorageSync('AnchorName');
} }
if(option && option.AnchorName){//当传过来有主播名称的时候 存入缓存 if (option && option.AnchorName) {
uni.setStorageSync("AnchorName", { AnchorName: option.AnchorName }); //当传过来有主播名称的时候 存入缓存
} uni.setStorageSync('AnchorName', { AnchorName: option.AnchorName });
this.u = uni.getStorageSync("mall_UserInfo"); }
// if (!this.u) { this.u = uni.getStorageSync('mall_UserInfo');
// this.u = { // if (!this.u) {
// nickName: "未登录", // this.u = {
// avatarUrl: "", // nickName: "未登录",
// }; // avatarUrl: "",
// this.showAuth = true; // };
// } else { // this.showAuth = true;
// this.init(); // } else {
// this.initPage(); // this.init();
// } // this.initPage();
this.init(); // }
this.initPage(); this.init();
this.getVipId() this.initPage();
this.getVipId();
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.setting = uni.getStorageSync("basedata").mall.setting; this.mc = this.$uiConfig.mainColor;
wx.showShareMenu({ this.secondary = this.$uiConfig.secondary;
withShareTicket:true,
menus:['shareAppMessage','shareTimeline']
})
},
onShareTimeline(){
setTimeout(()=>{
console.log('分享调用')
this.getReceive()
},2500)
let uid=uni.getStorageSync('mall_UserInfo') ?uni.getStorageSync('mall_UserInfo').UserId:0;
let title = this.g.app_share_title != null && this.g.app_share_title != ""? this.g.app_share_title : this.g.name;
let imageUrl = this.g.app_share_pic != null && this.g.app_share_pic != ""? this.g.app_share_pic : this.g.pic_url[0].pic_url;
let id = this.id
return{
title: title,
query: "id=" + this.id + "&user_id=" + uid,
imageUrl: imageUrl
}
},
onShareAppMessage(res) {
setTimeout(()=>{
console.log('分享调用')
this.getReceive()
},2500)
let u = uni.getStorageSync("mall_UserInfo");
let uid = u.UserId ? u.UserId : 0;
return {
title:
this.g.app_share_title != null && this.g.app_share_title != ""
? this.g.app_share_title
: this.g.name,
path: "/pages/goods/goods?id=" + this.id + "&user_id=" + uid,
imageUrl:
this.g.app_share_pic != null && this.g.app_share_pic != ""
? this.g.app_share_pic
: this.g.pic_url[0].pic_url,
};
},
mounted() {
setTimeout(() => {
this.initImages();
}, 3000);
},
methods: {
clickDescription(e) {
console.log(e);
},
initImages() {
// let that = this;
let info = uni.createSelectorQuery().in(this);
info
.select(".goods")
.boundingClientRect((data) => {
console.log("得到布局位置信息" + JSON.stringify(data));
})
.exec();
// info
// .boundingClientRect(function (data) {
// console.log(data)
// })
// .exec();
// wx.createSelectorQuery() this.setting = uni.getStorageSync('basedata').mall.setting;
// .selectAll("#goodpic") wx.showShareMenu({
// .fields({ rect: true }) withShareTicket: true,
// .exec(res => { menus: ['shareAppMessage', 'shareTimeline']
// console.log(res);
// });
},
reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth = false;
this.init();
this.initPage();
},
//关闭登录窗口
gbAuth() {
this.showAuth = false
},
initPage() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
clickCommentHandler() {
uni.navigateTo({
url: "/pages/goods/comment-list?id=" + this.id,
});
},
getVipId(){//获取会员ID
this.request2(
{
url: "/api/AppletGoods/GetAppletVipGradeInfo",
data: {},
},
(res) => {
if(res.data){
this.vipState = res.data.VIPModel
}
// this.initRecommend();
},
);
},
goVIP(){//跳转到购买的页面查看
let GradeId = this.vipState.Id
uni.navigateTo({
url: "/pages/share/buyInterest/index?showLook=1&GradeId="+GradeId,
}); });
}, },
init() { onShareTimeline() {
this.loading = true; setTimeout(() => {
this.request2( console.log('分享调用');
{ this.getReceive();
url: "/api/AppletGoods/GetAppletGoodsInfo", }, 2500);
data: { let uid = uni.getStorageSync('mall_UserInfo') ? uni.getStorageSync('mall_UserInfo').UserId : 0;
GoodsId: this.id, let title = this.g.app_share_title != null && this.g.app_share_title != '' ? this.g.app_share_title : this.g.name;
}, let imageUrl = this.g.app_share_pic != null && this.g.app_share_pic != '' ? this.g.app_share_pic : this.g.pic_url[0].pic_url;
}, let id = this.id;
(res) => { return {
if (res.resultCode == 1) { title: title,
this.g = res.data.goods; query: 'id=' + this.id + '&user_id=' + uid,
this.isAllowShare = res.data.goods.isAllowShare; //1为可以分享 2为不能分享 imageUrl: imageUrl
if(this.isAllowShare==2){ //隐藏分享的按钮 };
wx.hideShareMenu({ },
menus: ['shareAppMessage', 'shareTimeline'] onShareAppMessage(res) {
setTimeout(() => {
console.log('分享调用');
this.getReceive();
}, 2500);
let u = uni.getStorageSync('mall_UserInfo');
let uid = u.UserId ? u.UserId : 0;
return {
title: this.g.app_share_title != null && this.g.app_share_title != '' ? this.g.app_share_title : this.g.name,
path: '/pages/goods/goods?id=' + this.id + '&user_id=' + uid,
imageUrl: this.g.app_share_pic != null && this.g.app_share_pic != '' ? this.g.app_share_pic : this.g.pic_url[0].pic_url
};
},
mounted() {
setTimeout(() => {
this.initImages();
}, 3000);
},
methods: {
clickDescription(e) {
console.log(e);
},
initImages() {
// let that = this;
let info = uni.createSelectorQuery().in(this);
info.select('.goods')
.boundingClientRect(data => {
console.log('得到布局位置信息' + JSON.stringify(data));
}) })
} .exec();
this.g.pic_url.forEach((x) => { // info
this.imgs.push(x.pic_url); // .boundingClientRect(function (data) {
}); // console.log(data)
if (this.g.attr_groups.length > 0) { // })
this.g.attr_groups.forEach((x, i) => { // .exec();
if (i > 0) {
this.sku += ",";
}
this.sku += x.attr_group_name;
});
this.g.attr_groups[0].attr_list.forEach((x) => {
if (x.pic_url) {
this.skuimage.push(x.pic_url);
}
});
}
var richtext = this.g.detail; // wx.createSelectorQuery()
// richtext = richtext.replace( // .selectAll("#goodpic")
// /<img/g, // .fields({ rect: true })
// '< img style="margin-top:-4px;width:100%"' // .exec(res => {
// ); // console.log(res);
this.detailContent = richtext; // });
this.loading = false; },
reloadUserinfo() {
//登录在调用评论接口 this.u = uni.getStorageSync('mall_UserInfo');
if (this.u) { this.showAuth = false;
this.initComments();
this.setFootMarkInfo(res.data.goods.id);
}
this.initRecommend();
} else {
this.isExsitGoods = false;
}
}
);
},
previewImage(i) {
uni.previewImage({
urls: this.imgs,
current: i,
longPressActions: {
itemList: ["发送给朋友", "保存图片", "收藏"],
success: function (data) {
console.log(
"选中了第" +
(data.tapIndex + 1) +
"个按钮,第" +
(data.index + 1) +
"张图片"
);
},
fail: function (err) {
console.log(err.errMsg);
},
},
});
},
initComments() {
this.msg.GoodsId = this.id;
this.request2(
{
url: "/api/AppletOrder/GetAppletGoodsCommentPageList",
data: this.msg,
},
(res) => {
this.comments = res.data.pageData;
// this.initRecommend();
},
(err)=>{
this.u = uni.getStorageSync("mall_UserInfo");
this.init(); this.init();
this.initPage(); this.initPage();
} },
); //关闭登录窗口
}, gbAuth() {
initRecommend() { this.showAuth = false;
},
this.request2( initPage() {
{ let currentPages = getCurrentPages();
url: "/api/AppletGoods/GetAppletGoodsRecommendListForZY", let u = '/' + currentPages[currentPages.length - 1].route;
data: { let pages = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').bar_title : [];
RecommendType: 1, pages.forEach(x => {
}, if (x.value == u) {
}, this.pageTitle = x.new_name ? x.new_name : x.name;
(res) => { }
this.recommend = res.data.List; });
} uni.setNavigationBarTitle({
); title: this.pageTitle
}, });
setFootMarkInfo(id) { },
this.request2( clickCommentHandler() {
{ uni.navigateTo({
url: "/api/AppletUser/SetUserFootMarkInfo", url: '/pages/goods/comment-list?id=' + this.id
data: { });
GoodsId: id, },
}, getVipId() {
}, //获取会员ID
(res) => {} this.request2(
); {
}, url: '/api/AppletGoods/GetAppletVipGradeInfo',
joinCar() { data: {}
this.showSku = true; },
this.ot = 0; res => {
}, if (res.data) {
buy() { this.vipState = res.data.VIPModel;
this.showSku = true; }
this.ot = 1; // this.initRecommend();
}, }
chosenSku() { );
},
if(this.u){ goVIP() {
this.showSku = true; //跳转到购买的页面查看
this.ot = 2; let GradeId = this.vipState.Id;
}else{ uni.navigateTo({
this.showAuth = true url: '/pages/share/buyInterest/index?showLook=1&GradeId=' + GradeId
} });
}, },
closeSkuChosen(obj) { init() {
this.sku = ""; this.loading = true;
if (obj) { this.request2(
this.currentSku = obj; {
obj.attr_list.forEach((x, i) => { url: '/api/AppletGoods/GetAppletGoodsInfo',
if (i > 0) { data: {
this.sku += ","; GoodsId: this.id
} }
this.sku += `"${x.attr_name}" `; },
}); res => {
} else { if (res.resultCode == 1) {
this.g.attr_groups.forEach((x, i) => { this.g = res.data.goods;
if (i > 0) { this.isAllowShare = res.data.goods.isAllowShare; //1为可以分享 2为不能分享
this.sku += ","; if (this.isAllowShare == 2) {
} //隐藏分享的按钮
this.sku += x.attr_group_name; wx.hideShareMenu({
}); menus: ['shareAppMessage', 'shareTimeline']
} });
}, }
closeShare() { this.g.pic_url.forEach(x => {
this.showShare = false; this.imgs.push(x.pic_url);
}, });
openShare() { if (this.g.attr_groups.length > 0) {
this.showShare = true; this.g.attr_groups.forEach((x, i) => {
}, if (i > 0) {
getReceive(){//分享进入调取领券接口 this.sku += ',';
// 1-分享,2-购买并付款 }
this.request2( this.sku += x.attr_group_name;
{ });
url: "/api/AppletUser/ShareCoupon", this.g.attr_groups[0].attr_list.forEach(x => {
data: { if (x.pic_url) {
TriggerType: 1, this.skuimage.push(x.pic_url);
}, }
}, });
(res) => { }
console.log(res,'res')
if(res.couponResultCode ==1){ var richtext = this.g.detail;
this.couponMessage = res.couponMessage // richtext = richtext.replace(
this.showCoupons = true; // /<img/g,
// '< img style="margin-top:-4px;width:100%"'
// );
this.detailContent = richtext;
this.loading = false;
//登录在调用评论接口
if (this.u) {
this.initComments();
this.setFootMarkInfo(res.data.goods.id);
}
this.initRecommend();
} else {
this.isExsitGoods = false;
}
}
);
},
previewImage(i) {
uni.previewImage({
urls: this.imgs,
current: i,
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function(data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,' + (data.index + 1) + '张图片');
},
fail: function(err) {
console.log(err.errMsg);
}
}
});
},
initComments() {
this.msg.GoodsId = this.id;
this.request2(
{
url: '/api/AppletOrder/GetAppletGoodsCommentPageList',
data: this.msg
},
res => {
this.comments = res.data.pageData;
// this.initRecommend();
},
err => {
this.u = uni.getStorageSync('mall_UserInfo');
this.init();
this.initPage();
}
);
},
initRecommend() {
this.request2(
{
url: '/api/AppletGoods/GetAppletGoodsRecommendListForZY',
data: {
RecommendType: 1
}
},
res => {
this.recommend = res.data.List;
}
);
},
setFootMarkInfo(id) {
this.request2(
{
url: '/api/AppletUser/SetUserFootMarkInfo',
data: {
GoodsId: id
}
},
res => {}
);
},
joinCar() {
console.log('触发1');
this.showSku = true;
this.ot = 0;
},
buy() {
this.showSku = true;
this.ot = 1;
},
chosenSku() {
if (this.u) {
this.showSku = true;
this.ot = 2;
} else {
this.showAuth = true;
} }
} },
); closeSkuChosen(obj) {
}, this.sku = '';
goLook(){ if (obj) {
this.showCoupons = true; this.currentSku = obj;
uni.navigateTo({ obj.attr_list.forEach((x, i) => {
url: "/pages/coupon/index/index", if (i > 0) {
}); this.sku += ',';
}, }
closeBtn(){ this.sku += `"${x.attr_name}" `;
this.showCoupons = false });
}, } else {
goUrl(url) { this.g.attr_groups.forEach((x, i) => {
if (i > 0) {
this.sku += ',';
}
this.sku += x.attr_group_name;
});
}
},
closeShare() {
this.showShare = false;
},
openShare() {
this.showShare = true;
},
getReceive() {
//分享进入调取领券接口
// 1-分享,2-购买并付款
this.request2(
{
url: '/api/AppletUser/ShareCoupon',
data: {
TriggerType: 1
}
},
res => {
console.log(res, 'res');
if (res.couponResultCode == 1) {
this.couponMessage = res.couponMessage;
this.showCoupons = true;
}
}
);
},
goLook() {
this.showCoupons = true;
uni.navigateTo({
url: '/pages/coupon/index/index'
});
},
closeBtn() {
this.showCoupons = false;
},
goUrl(url) {
uni.navigateTo({ uni.navigateTo({
url: url url: url
}); });
}, }
}
},
}; };
</script> </script>
<style> <style>
@font-face { @font-face {
font-family: "oswald"; font-family: 'oswald';
src: url("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/smallapp/Oswald-Regular.ttf"); src: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/smallapp/Oswald-Regular.ttf');
} }
.goods { .goods {
height: 100%; height: 100%;
background: #f5f5f5; background: #f5f5f5;
padding-bottom: 55px; padding-bottom: 55px;
} }
.goods .g-info { .goods .g-info {
background: #fff; background: #fff;
padding: 10px; padding: 10px;
} }
.goods .g-info .g-name { .goods .g-info .g-name {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
font-size: 16px; font-size: 16px;
height: 45px; height: 45px;
} }
.goods .g-info .g-price-box { .goods .g-info .g-price-box {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
} }
.goods .g-info .g-price-box .left { .goods .g-info .g-price-box .left {
flex: 1; flex: 1;
width: 1px; width: 1px;
} }
.goods .g-info .g-price-box .left .price { .goods .g-info .g-price-box .left .price {
margin: 15px 0; margin: 15px 0;
font-size: 24px; font-size: 24px;
font-weight: bold; font-weight: bold;
height: 31px; height: 31px;
} }
.goods .g-info .g-price-box .left .price .small { .goods .g-info .g-price-box .left .price .small {
font-size: 16px; font-size: 16px;
} }
.goods .numfont { .goods .numfont {
font-family: "oswald"; font-family: 'oswald';
font-weight: unset; font-weight: unset;
} }
.goods .g-info .g-price-box .left .sell { .goods .g-info .g-price-box .left .sell {
font-size: 12px; font-size: 12px;
color: gray; color: gray;
} }
.goods .g-info .g-price-box .left .sell .oprice { .goods .g-info .g-price-box .left .sell .oprice {
text-decoration: line-through; text-decoration: line-through;
margin-right: 12px; margin-right: 12px;
} }
.goods .g-info .g-price-box .right { .goods .g-info .g-price-box .right {
width: 30px; width: 30px;
margin-left: 20px; margin-left: 20px;
height: 100%; height: 100%;
font-size: 12px; font-size: 12px;
color: #333; color: #333;
} }
.goods .g-info .g-price-box .right .share-icon { .goods .g-info .g-price-box .right .share-icon {
width: 22px; width: 22px;
height: 22px; height: 22px;
margin-bottom: 12rpx; margin-bottom: 12rpx;
} }
.goods .sku-box { .goods .sku-box {
margin: 10px 0; margin: 10px 0;
background: #fff; background: #fff;
display: flex; display: flex;
padding: 15px 10px; padding: 15px 10px;
align-items: center; align-items: center;
} }
.goods .sku-box .label { .goods .sku-box .label {
font-size: 12px; font-size: 12px;
color: gray; color: gray;
margin-right: 15px; margin-right: 15px;
} }
.goods .details { .goods .details {
padding: 10px; padding: 10px;
} }
.goods .sku-box .content { .goods .sku-box .content {
width: 1px; width: 1px;
flex: 1; flex: 1;
color: #000; color: #000;
font-size: 12px; font-size: 12px;
} }
.goods .sku-box .content .sku-chosen { .goods .sku-box .content .sku-chosen {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.goods .sku-box .content .sku-chosen .arrow { .goods .sku-box .content .sku-chosen .arrow {
width: 20px; width: 20px;
} }
.goods .sku-box .content .sku-chosen .sku { .goods .sku-box .content .sku-chosen .sku {
font-size: 12px; font-size: 12px;
width: 1rpx; width: 1rpx;
flex: 1; flex: 1;
} }
.goods .sku-box .content .suk-item { .goods .sku-box .content .suk-item {
margin-top: 10px; margin-top: 10px;
display: flex; display: flex;
} }
.goods .sku-box .content .suk-item .item { .goods .sku-box .content .suk-item .item {
margin-right: 5px; margin-right: 5px;
background: #f5f5f5; background: #f5f5f5;
height: 24px; height: 24px;
line-height: 24px; line-height: 24px;
font-size: 12px; font-size: 12px;
padding: 0 5px; padding: 0 5px;
border-radius: 3px; border-radius: 3px;
overflow: hidden; overflow: hidden;
color: #999; color: #999;
} }
.goods .sku-box .content .suk-item .item.img { .goods .sku-box .content .suk-item .item.img {
padding: 0; padding: 0;
width: 24px; width: 24px;
} }
.goods .comment { .goods .comment {
margin: 10px 0; margin: 10px 0;
background: #fff; background: #fff;
padding: 10px; padding: 10px;
} }
.goods .comment .chead { .goods .comment .chead {
padding-bottom: 10px; padding-bottom: 10px;
border-bottom: 1px solid #f1f1f1; border-bottom: 1px solid #f1f1f1;
} }
.goods .comment .content { .goods .comment .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-top: 15px; margin-top: 15px;
} }
.goods .comment .content .u-box { .goods .comment .content .u-box {
display: flex; display: flex;
margin-bottom: 10px; margin-bottom: 10px;
align-items: center; align-items: center;
} }
.goods .comment .content .u-box .user { .goods .comment .content .u-box .user {
flex: 1; flex: 1;
font-size: 12px; font-size: 12px;
color: gray; color: gray;
align-items: center; align-items: center;
display: flex; display: flex;
} }
.goods .comment .content .u-box .timer { .goods .comment .content .u-box .timer {
font-size: 12px; font-size: 12px;
color: gray; color: gray;
text-align: right; text-align: right;
flex: 1; flex: 1;
} }
.goods .comment .content .u-box .ucontent { .goods .comment .content .u-box .ucontent {
font-size: 12px; font-size: 12px;
color: #000; color: #000;
margin-top: 10px; margin-top: 10px;
} }
.goods .detals { .goods .detals {
padding: 10px; padding: 10px;
background: #fff; background: #fff;
margin-top: 10px; margin-top: 10px;
} }
.goods .detals * { .goods .detals * {
max-width: 100%; max-width: 100%;
} }
.goods .is_share { .goods .is_share {
width: 120px; width: 120px;
height: 45px; height: 45px;
border-top-left-radius: 22.5px; border-top-left-radius: 22.5px;
border-bottom-left-radius: 22.5px; border-bottom-left-radius: 22.5px;
background: #111; background: #111;
opacity: 0.8; opacity: 0.8;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
position: absolute; position: absolute;
top: 300px; top: 300px;
right: 0; right: 0;
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment