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

代码格式化

parent 682d2acb
...@@ -2,22 +2,10 @@ ...@@ -2,22 +2,10 @@
<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"
height="100"
unit="vw"
:interval="10000"
name="pic_url"
:border-radius="0"
@click="previewImage"
></u-swiper>
<!-- TODO 分销价格未做 is_share_price --> <!-- TODO 分销价格未做 is_share_price -->
<view class="is_share" v-if="g.share > 0" style="top:240px;"> <view class="is_share" v-if="g.share > 0" style="top:240px;">
<image <image src="@/static/images/icon/WechatIMG424.png" style="width: 20px; margin-left: 12px; opacity: 1;height: auto;" mode="widthFix" />
src="@/static/images/icon/WechatIMG424.png"
style="width: 20px; margin-left: 12px; opacity: 1;height: auto;"
mode="widthFix"
/>
<view <view
style=" style="
display: flex; display: flex;
...@@ -32,12 +20,8 @@ ...@@ -32,12 +20,8 @@
<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"
style="width: 20px; margin-left: 12px; opacity: 1;"
mode="widthFix"
/>
<view <view
style=" style="
display: flex; display: flex;
...@@ -59,66 +43,46 @@ ...@@ -59,66 +43,46 @@
<view class="left"> <view class="left">
<view class="price u-skeleton-rect" :style="{ color: mc }"> <view class="price u-skeleton-rect" :style="{ color: mc }">
<text class="small"></text> <text class="small"></text>
<text class="numfont"> <text class="numfont">{{ g.price_min == g.price_max ? g.price_min : g.price_min + '-' + g.price_max }}</text>
{{
g.price_min == g.price_max
? g.price_min
: g.price_min + "-" + g.price_max
}}
</text>
</view> </view>
<!-- TODO is_common_user_member_price 普通用户会员价 --> <!-- TODO is_common_user_member_price 普通用户会员价 -->
<!-- TODO is_member_user_member_price 会员用户会员价 --> <!-- TODO is_member_user_member_price 会员用户会员价 -->
<view class="sell u-skeleton-rect"> <view class="sell u-skeleton-rect">
<text class="oprice" v-if="setting.is_underline_price == 1"> <text class="oprice" v-if="setting.is_underline_price == 1">{{ g.original_price }}</text>
{{ g.original_price }} <text v-if="setting.is_sales == 1">已售出{{ g.sales }}{{ g.unit }}</text>
</text>
<text v-if="setting.is_sales == 1"
>已售出{{ g.sales }}{{ g.unit }}</text
>
</view> </view>
</view> </view>
<view class="right u-skeleton-rect" @click="openShare" v-if="isAllowShare==1"> <view class="right u-skeleton-rect" @click="openShare" v-if="isAllowShare == 1">
<image <image src="@/static/images/icon/icon-share.png" class="share-icon" />
src="@/static/images/icon/icon-share.png"
class="share-icon"
/>
<text>分享</text> <text>分享</text>
</view> </view>
</view> </view>
</view> </view>
<view <view class="sku-box u-skeleton-rect" style="align-items: flex-start;">
class="sku-box u-skeleton-rect" <view class="label" style="margin-top: 5px;">活动</view>
style="align-items: flex-start;" <view class="content" style="display: flex;flex-direction: column">
>
<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 != ''"> <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" /> <u-tag text="送积分" type="error" />
<text style="margin-left: 5px; font-size: 12px;">{{ <text style="margin-left: 5px; font-size: 12px;">{{ g.goods_marketing_award.integral.title }}</text>
g.goods_marketing_award.integral.title
}}</text>
</view> </view>
<view style="display: flex;flex-direction: row;align-items: center" v-if="g.goods_marketing_award.PresentFXGradeMsg != ''" @click="goVIP"> <view style="display: flex;flex-direction: row;align-items: center" v-if="g.goods_marketing_award.PresentFXGradeMsg != ''" @click="goVIP">
<u-tag text="送会员" type="error" /> <u-tag text="送会员" type="error" />
<text style="margin-left: 5px; font-size: 12px;">{{ <text style="margin-left: 5px; font-size: 12px;">{{ g.goods_marketing_award.PresentFXGradeMsg }}</text>
g.goods_marketing_award.PresentFXGradeMsg
}}</text>
</view> </view>
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 5px;" @click="goUrl(g.FreeShippingUrl)" <view
v-if=" g.freeShippingName!=null && g.freeShippingName !='' &&(g.fullMoneyPinkage > 0 || g.fullNumPinkage>0)" 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;"> <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:''}} {{ g.freeShippingName != null ? g.freeShippingName : '' }}
</view> </view>
{{g.fullMoneyPinkage>0 && g.fullNumPinkage==0?g.fullMoneyPinkage+'元包邮':''}} {{ g.fullMoneyPinkage > 0 && g.fullNumPinkage == 0 ? g.fullMoneyPinkage + '元包邮' : '' }}
{{g.fullMoneyPinkage==0 && g.fullNumPinkage>0?g.fullNumPinkage+'件包邮':''}} {{ g.fullMoneyPinkage == 0 && g.fullNumPinkage > 0 ? g.fullNumPinkage + '件包邮' : '' }}
</view> </view>
<!-- <view style="margin-top: 5px;" v-if=" <!-- <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 == '' &&
...@@ -127,91 +91,49 @@ ...@@ -127,91 +91,49 @@
<text>暂无活动</text> <text>暂无活动</text>
</view> --> </view> -->
</view> </view>
</view> </view>
<view <view class="sku-box u-skeleton-rect" style="align-items: flex-start;" v-if="sku.length > 0">
class="sku-box u-skeleton-rect"
style="align-items: flex-start;"
v-if="sku.length > 0"
>
<view class="label">选择</view> <view class="label">选择</view>
<view class="content"> <view class="content">
<view class="sku-chosen" @click="chosenSku"> <view class="sku-chosen" @click="chosenSku">
<view class="sku" <view class="sku">{{ currentSku.attr_list.length > 0 ? '已' : '请' }}选择 {{ sku }}</view>
>{{ currentSku.attr_list.length > 0 ? "已" : "请" }}选择 <view class="arrow"><u-icon name="arrow" :size="32" color="#111"></u-icon></view>
{{ sku }}</view
>
<view class="arrow">
<u-icon name="arrow" :size="32" color="#111"></u-icon>
</view>
</view> </view>
<view class="suk-item" style="flex-wrap: wrap;"> <view class="suk-item" style="flex-wrap: wrap;">
<template v-if="skuimage.length > 0"> <template v-if="skuimage.length > 0">
<view <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>
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"> <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> </view>
</template> </template>
<template v-else> <template v-else>
<template v-for="(x, i) in g.attr_groups[0].attr_list"> <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>
class="item"
v-if="i < 5"
:key="i"
style="margin-bottom: 5px;"
>{{ x.attr_name }}</view
>
</template> </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> </view>
</template> </template>
</view> </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 <view class="sku-box u-skeleton-rect" style="margin-top: -10;" v-if="g.goods_marketing.shipping != ''">
class="sku-box u-skeleton-rect"
style="margin-top: -10;"
v-if="g.goods_marketing.shipping != ''"
>
<view class="label">包邮</view> <view class="label">包邮</view>
<view class="content">{{ g.goods_marketing.shipping }}</view> <view class="content">{{ g.goods_marketing.shipping }}</view>
</view> </view>
<view <view class="sku-box u-skeleton-rect" style="margin-top: -10;" v-if="g.goods_marketing.limit != ''">
class="sku-box u-skeleton-rect"
style="margin-top: -10;"
v-if="g.goods_marketing.limit != ''"
>
<view class="label">限购</view> <view class="label">限购</view>
<view class="content">{{ g.goods_marketing.limit }}</view> <view class="content">{{ g.goods_marketing.limit }}</view>
</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"
v-if="comments.length == 0 && setting.is_comment == 1"
>
<view class="label">暂无评论信息</view>
</view>
<view class="comment" v-if="comments.length > 0"> <view class="comment" v-if="comments.length > 0">
<view class="chead"> <view class="chead">
<u-section <u-section
...@@ -228,49 +150,23 @@ ...@@ -228,49 +150,23 @@
<view class="u-box"> <view class="u-box">
<view class="user"> <view class="user">
<u-avatar :src="comments[0].UserPhotoPath" :size="50"></u-avatar> <u-avatar :src="comments[0].UserPhotoPath" :size="50"></u-avatar>
<text style="margin-left: 10px;"> <text style="margin-left: 10px;">{{ comments[0].UserName }}</text>
{{ comments[0].UserName }}
</text>
</view> </view>
<view class="timer">{{ comments[0].CreateDate }}</view> <view class="timer">{{ comments[0].CreateDate }}</view>
</view> </view>
<view class="ucontent">{{ comments[0].Content }}</view> <view class="ucontent">{{ comments[0].Content }}</view>
</view> </view>
</view> </view>
<u-divider :margin-top="20" :margin-bottom="20" bg-color="transparent" <u-divider :margin-top="20" :margin-bottom="20" bg-color="transparent">商品详情</u-divider>
>商品详情</u-divider
>
<view class="details"> <view class="details">
<!-- <rich-text :nodes="detailContent" @click="clickDescription"></rich-text> --> <!-- <rich-text :nodes="detailContent" @click="clickDescription"></rich-text> -->
<h-parse <h-parse :content="detailContent" @navigate="clickDescription"></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> </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"
:animation="true"
bgcolor="#FFF"
></u-skeleton>
<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>
<goodsku <goodsku
v-if="!loading && showSku" v-if="!loading && showSku"
border-radius="10" border-radius="10"
...@@ -283,44 +179,24 @@ ...@@ -283,44 +179,24 @@
@close="closeSkuChosen" @close="closeSkuChosen"
></goodsku> ></goodsku>
</view> </view>
<u-empty <u-empty text="没有找到商品,或商品已下架" mode="favor" v-if="!isExsitGoods"></u-empty>
text="没有找到商品,或商品已下架" <share :good-id="id" v-if="showShare" :good-name="g.name" :images="g.pic_url" :advertising="g.advertising" @close="closeShare"></share>
mode="favor" <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
v-if="!isExsitGoods" <coupon v-if="showCoupons" :coupon-message="couponMessage" @goLook="goLook" @closeBtn="closeBtn"></coupon>
></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> </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 {
...@@ -328,20 +204,20 @@ export default { ...@@ -328,20 +204,20 @@ export default {
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,
...@@ -349,14 +225,14 @@ export default { ...@@ -349,14 +225,14 @@ export default {
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: {
...@@ -366,35 +242,36 @@ export default { ...@@ -366,35 +242,36 @@ export default {
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){ if (option && option.custom_params) {
let custom_params = JSON.parse(decodeURIComponent(option.custom_params)) let custom_params = JSON.parse(decodeURIComponent(option.custom_params));
console.log(custom_params) console.log(custom_params);
if(custom_params.user_id){ if (custom_params.user_id) {
uni.setStorageSync("pid", { pid: custom_params.user_id}); uni.setStorageSync('pid', { pid: custom_params.user_id });
} }
} }
if (option && option.user_id) { if (option && option.user_id) {
uni.setStorageSync("pid", { pid: option.user_id }); uni.setStorageSync('pid', { pid: option.user_id });
} }
if(uni.getStorageSync("AnchorName")){ //如果有主播名称了先清除 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"); this.u = uni.getStorageSync('mall_UserInfo');
// if (!this.u) { // if (!this.u) {
// this.u = { // this.u = {
// nickName: "未登录", // nickName: "未登录",
...@@ -407,49 +284,43 @@ export default { ...@@ -407,49 +284,43 @@ export default {
// } // }
this.init(); this.init();
this.initPage(); this.initPage();
this.getVipId() this.getVipId();
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary; this.secondary = this.$uiConfig.secondary;
this.setting = uni.getStorageSync("basedata").mall.setting; this.setting = uni.getStorageSync('basedata').mall.setting;
wx.showShareMenu({ wx.showShareMenu({
withShareTicket:true, withShareTicket: true,
menus:['shareAppMessage','shareTimeline'] menus: ['shareAppMessage', 'shareTimeline']
}) });
}, },
onShareTimeline(){ onShareTimeline() {
setTimeout(()=>{ setTimeout(() => {
console.log('分享调用') console.log('分享调用');
this.getReceive() this.getReceive();
},2500) }, 2500);
let uid=uni.getStorageSync('mall_UserInfo') ?uni.getStorageSync('mall_UserInfo').UserId:0; 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 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 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 let id = this.id;
return{ return {
title: title, title: title,
query: "id=" + this.id + "&user_id=" + uid, query: 'id=' + this.id + '&user_id=' + uid,
imageUrl: imageUrl imageUrl: imageUrl
} };
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
setTimeout(()=>{ setTimeout(() => {
console.log('分享调用') console.log('分享调用');
this.getReceive() this.getReceive();
},2500) }, 2500);
let u = uni.getStorageSync("mall_UserInfo"); let u = uni.getStorageSync('mall_UserInfo');
let uid = u.UserId ? u.UserId : 0; let uid = u.UserId ? u.UserId : 0;
return { return {
title: title: this.g.app_share_title != null && this.g.app_share_title != '' ? this.g.app_share_title : this.g.name,
this.g.app_share_title != null && this.g.app_share_title != "" path: '/pages/goods/goods?id=' + this.id + '&user_id=' + uid,
? this.g.app_share_title imageUrl: this.g.app_share_pic != null && this.g.app_share_pic != '' ? this.g.app_share_pic : this.g.pic_url[0].pic_url
: 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() { mounted() {
...@@ -464,10 +335,9 @@ export default { ...@@ -464,10 +335,9 @@ export default {
initImages() { initImages() {
// let that = this; // let that = this;
let info = uni.createSelectorQuery().in(this); let info = uni.createSelectorQuery().in(this);
info info.select('.goods')
.select(".goods") .boundingClientRect(data => {
.boundingClientRect((data) => { console.log('得到布局位置信息' + JSON.stringify(data));
console.log("得到布局位置信息" + JSON.stringify(data));
}) })
.exec(); .exec();
// info // info
...@@ -484,85 +354,85 @@ export default { ...@@ -484,85 +354,85 @@ export default {
// }); // });
}, },
reloadUserinfo() { reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo"); this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false; this.showAuth = false;
this.init(); this.init();
this.initPage(); this.initPage();
}, },
//关闭登录窗口 //关闭登录窗口
gbAuth() { gbAuth() {
this.showAuth = false this.showAuth = false;
}, },
initPage() { initPage() {
let currentPages = getCurrentPages(); let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route; let u = '/' + currentPages[currentPages.length - 1].route;
let pages = uni.getStorageSync("basedata") let pages = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').bar_title : [];
? uni.getStorageSync("basedata").bar_title pages.forEach(x => {
: [];
pages.forEach((x) => {
if (x.value == u) { if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name; this.pageTitle = x.new_name ? x.new_name : x.name;
} }
}); });
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.pageTitle, title: this.pageTitle
}); });
}, },
clickCommentHandler() { clickCommentHandler() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/goods/comment-list?id=" + this.id, url: '/pages/goods/comment-list?id=' + this.id
}); });
}, },
getVipId(){//获取会员ID getVipId() {
//获取会员ID
this.request2( this.request2(
{ {
url: "/api/AppletGoods/GetAppletVipGradeInfo", url: '/api/AppletGoods/GetAppletVipGradeInfo',
data: {}, data: {}
}, },
(res) => { res => {
if(res.data){ if (res.data) {
this.vipState = res.data.VIPModel this.vipState = res.data.VIPModel;
} }
// this.initRecommend(); // this.initRecommend();
}, }
); );
}, },
goVIP(){//跳转到购买的页面查看 goVIP() {
let GradeId = this.vipState.Id //跳转到购买的页面查看
let GradeId = this.vipState.Id;
uni.navigateTo({ uni.navigateTo({
url: "/pages/share/buyInterest/index?showLook=1&GradeId="+GradeId, url: '/pages/share/buyInterest/index?showLook=1&GradeId=' + GradeId
}); });
}, },
init() { init() {
this.loading = true; this.loading = true;
this.request2( this.request2(
{ {
url: "/api/AppletGoods/GetAppletGoodsInfo", url: '/api/AppletGoods/GetAppletGoodsInfo',
data: { data: {
GoodsId: this.id, GoodsId: this.id
}, }
}, },
(res) => { res => {
if (res.resultCode == 1) { if (res.resultCode == 1) {
this.g = res.data.goods; this.g = res.data.goods;
this.isAllowShare = res.data.goods.isAllowShare; //1为可以分享 2为不能分享 this.isAllowShare = res.data.goods.isAllowShare; //1为可以分享 2为不能分享
if(this.isAllowShare==2){ //隐藏分享的按钮 if (this.isAllowShare == 2) {
//隐藏分享的按钮
wx.hideShareMenu({ wx.hideShareMenu({
menus: ['shareAppMessage', 'shareTimeline'] menus: ['shareAppMessage', 'shareTimeline']
}) });
} }
this.g.pic_url.forEach((x) => { this.g.pic_url.forEach(x => {
this.imgs.push(x.pic_url); this.imgs.push(x.pic_url);
}); });
if (this.g.attr_groups.length > 0) { if (this.g.attr_groups.length > 0) {
this.g.attr_groups.forEach((x, i) => { this.g.attr_groups.forEach((x, i) => {
if (i > 0) { if (i > 0) {
this.sku += ","; this.sku += ',';
} }
this.sku += x.attr_group_name; this.sku += x.attr_group_name;
}); });
this.g.attr_groups[0].attr_list.forEach((x) => { this.g.attr_groups[0].attr_list.forEach(x => {
if (x.pic_url) { if (x.pic_url) {
this.skuimage.push(x.pic_url); this.skuimage.push(x.pic_url);
} }
...@@ -594,51 +464,44 @@ export default { ...@@ -594,51 +464,44 @@ export default {
urls: this.imgs, urls: this.imgs,
current: i, current: i,
longPressActions: { longPressActions: {
itemList: ["发送给朋友", "保存图片", "收藏"], itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) { success: function(data) {
console.log( console.log('选中了第' + (data.tapIndex + 1) + '个按钮,' + (data.index + 1) + '张图片');
"选中了第" +
(data.tapIndex + 1) +
"个按钮,第" +
(data.index + 1) +
"张图片"
);
}, },
fail: function (err) { fail: function(err) {
console.log(err.errMsg); console.log(err.errMsg);
}, }
}, }
}); });
}, },
initComments() { initComments() {
this.msg.GoodsId = this.id; this.msg.GoodsId = this.id;
this.request2( this.request2(
{ {
url: "/api/AppletOrder/GetAppletGoodsCommentPageList", url: '/api/AppletOrder/GetAppletGoodsCommentPageList',
data: this.msg, data: this.msg
}, },
(res) => { res => {
this.comments = res.data.pageData; this.comments = res.data.pageData;
// this.initRecommend(); // this.initRecommend();
}, },
(err)=>{ err => {
this.u = uni.getStorageSync("mall_UserInfo"); this.u = uni.getStorageSync('mall_UserInfo');
this.init(); this.init();
this.initPage(); this.initPage();
} }
); );
}, },
initRecommend() { initRecommend() {
this.request2( this.request2(
{ {
url: "/api/AppletGoods/GetAppletGoodsRecommendListForZY", url: '/api/AppletGoods/GetAppletGoodsRecommendListForZY',
data: { data: {
RecommendType: 1, RecommendType: 1
}, }
}, },
(res) => { res => {
this.recommend = res.data.List; this.recommend = res.data.List;
} }
); );
...@@ -646,15 +509,16 @@ export default { ...@@ -646,15 +509,16 @@ export default {
setFootMarkInfo(id) { setFootMarkInfo(id) {
this.request2( this.request2(
{ {
url: "/api/AppletUser/SetUserFootMarkInfo", url: '/api/AppletUser/SetUserFootMarkInfo',
data: { data: {
GoodsId: id, GoodsId: id
}, }
}, },
(res) => {} res => {}
); );
}, },
joinCar() { joinCar() {
console.log('触发1');
this.showSku = true; this.showSku = true;
this.ot = 0; this.ot = 0;
}, },
...@@ -663,28 +527,27 @@ export default { ...@@ -663,28 +527,27 @@ export default {
this.ot = 1; this.ot = 1;
}, },
chosenSku() { chosenSku() {
if (this.u) {
if(this.u){
this.showSku = true; this.showSku = true;
this.ot = 2; this.ot = 2;
}else{ } else {
this.showAuth = true this.showAuth = true;
} }
}, },
closeSkuChosen(obj) { closeSkuChosen(obj) {
this.sku = ""; this.sku = '';
if (obj) { if (obj) {
this.currentSku = obj; this.currentSku = obj;
obj.attr_list.forEach((x, i) => { obj.attr_list.forEach((x, i) => {
if (i > 0) { if (i > 0) {
this.sku += ","; this.sku += ',';
} }
this.sku += `"${x.attr_name}" `; this.sku += `"${x.attr_name}" `;
}); });
} else { } else {
this.g.attr_groups.forEach((x, i) => { this.g.attr_groups.forEach((x, i) => {
if (i > 0) { if (i > 0) {
this.sku += ","; this.sku += ',';
} }
this.sku += x.attr_group_name; this.sku += x.attr_group_name;
}); });
...@@ -696,48 +559,47 @@ export default { ...@@ -696,48 +559,47 @@ export default {
openShare() { openShare() {
this.showShare = true; this.showShare = true;
}, },
getReceive(){//分享进入调取领券接口 getReceive() {
//分享进入调取领券接口
// 1-分享,2-购买并付款 // 1-分享,2-购买并付款
this.request2( this.request2(
{ {
url: "/api/AppletUser/ShareCoupon", url: '/api/AppletUser/ShareCoupon',
data: { data: {
TriggerType: 1, TriggerType: 1
}, }
}, },
(res) => { res => {
console.log(res,'res') console.log(res, 'res');
if(res.couponResultCode ==1){ if (res.couponResultCode == 1) {
this.couponMessage = res.couponMessage this.couponMessage = res.couponMessage;
this.showCoupons = true; this.showCoupons = true;
} }
} }
); );
}, },
goLook(){ goLook() {
this.showCoupons = true; this.showCoupons = true;
uni.navigateTo({ uni.navigateTo({
url: "/pages/coupon/index/index", url: '/pages/coupon/index/index'
}); });
}, },
closeBtn(){ closeBtn() {
this.showCoupons = false this.showCoupons = false;
}, },
goUrl(url) { 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%;
...@@ -775,7 +637,7 @@ export default { ...@@ -775,7 +637,7 @@ export default {
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 {
......
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