|
|
@@ -14,7 +14,7 @@
|
|
|
></swiper-banner>
|
|
|
<!-- 轮播图-end -->
|
|
|
<!-- 价格信息栏 -->
|
|
|
- <view class="price_info flex_r flex_ac flex_jb">
|
|
|
+ <view class="price_info flex_r flex_ac flex_jb" v-if="type == 1">
|
|
|
<view class="price flex_c flex_jb">
|
|
|
<view class="text1"> 到手价 </view>
|
|
|
<view class="bottom">
|
|
|
@@ -25,7 +25,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="price flex_c flex_jb">
|
|
|
- <view class="text4">预估下单返</view>
|
|
|
+ <view class="text4">预估下单获</view>
|
|
|
<view class="text5 bottom">
|
|
|
{{ yj_price }}
|
|
|
</view>
|
|
|
@@ -35,10 +35,34 @@
|
|
|
<view class="text7 bottom">{{ detail.sales_tip }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="price_info flex_r flex_ac flex_jb" v-else-if="type == 2">
|
|
|
+ <view class="price flex_c flex_jb">
|
|
|
+ <view class="text1"> 到手价 </view>
|
|
|
+ <view class="bottom">
|
|
|
+ <span class="text2">
|
|
|
+ {{ goods_price }}
|
|
|
+ </span>
|
|
|
+ <text class="text3">¥{{ detail.reserve_price }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="price flex_c flex_jb">
|
|
|
+ <view class="text4">预估下单获</view>
|
|
|
+ <view class="text5 bottom">
|
|
|
+ {{ yj_price }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="price flex_c flex_jb">
|
|
|
+ <view class="text6">销量</view>
|
|
|
+ <view class="text7 bottom">{{ decodeURIComponent(annual_vol) }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="chabao">
|
|
|
+ 预估下单获得茶宝:{{ Math.floor(goods_price * chabao_ratio * 100) / 100 }}
|
|
|
+ </view>
|
|
|
<!-- 价格信息栏-end -->
|
|
|
<!-- 标题信息栏 -->
|
|
|
<view class="title_info">
|
|
|
- <view class="goods_name">
|
|
|
+ <view class="goods_name" v-if="type == 1">
|
|
|
<span class="product-type">
|
|
|
{{
|
|
|
tabs.filter((t) => {
|
|
|
@@ -48,7 +72,20 @@
|
|
|
</span>
|
|
|
{{ detail.goods_name }}
|
|
|
</view>
|
|
|
- <view class="quan flex_r flex_ac flex_jb" v-if="detail.has_coupon">
|
|
|
+ <view class="goods_name" v-else-if="type == 2">
|
|
|
+ <span class="product-type">
|
|
|
+ {{
|
|
|
+ tabs.filter((t) => {
|
|
|
+ return type == t.type;
|
|
|
+ })[0].name
|
|
|
+ }}
|
|
|
+ </span>
|
|
|
+ {{ detail.title }}
|
|
|
+ </view>
|
|
|
+ <view
|
|
|
+ class="quan flex_r flex_ac flex_jb"
|
|
|
+ v-if="type == 1 && detail.has_coupon"
|
|
|
+ >
|
|
|
<view class="left flex_r flex_ac">
|
|
|
<view class="quan_price">{{ detail.coupon_discount / 100 }}</view>
|
|
|
<view class="flex_c time">
|
|
|
@@ -63,6 +100,24 @@
|
|
|
<view class="split"></view>
|
|
|
<view class="right" @click="buttonClick"> 立即领券 </view>
|
|
|
</view>
|
|
|
+ <view
|
|
|
+ class="quan flex_r flex_ac flex_jb"
|
|
|
+ v-if="type == 2 && coupon_discount"
|
|
|
+ >
|
|
|
+ <view class="left flex_r flex_ac">
|
|
|
+ <view class="quan_price">{{ coupon_discount }}</view>
|
|
|
+ <view class="flex_c time">
|
|
|
+ <span>专属优惠券</span>
|
|
|
+ <span>
|
|
|
+ {{ $day(promotion_start_time/1000 *1000).format("YYYY.MM.DD") }}
|
|
|
+ -
|
|
|
+ {{ $day(promotion_end_time/1000 *1000).format("YYYY.MM.DD") }}
|
|
|
+ </span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="split"></view>
|
|
|
+ <view class="right" @click="buttonClick"> 立即领券 </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="mall flex_r flex_ac">
|
|
|
<img
|
|
|
@@ -70,7 +125,8 @@
|
|
|
alt=""
|
|
|
class="mall_img"
|
|
|
/>
|
|
|
- <view class="text7 bottom">{{ detail.mall_name }}</view>
|
|
|
+ <view class="text7 bottom" v-if="type == 1">{{ detail.mall_name }}</view>
|
|
|
+ <view class="text7 bottom" v-else-if="type == 2">{{ detail.nick }}</view>
|
|
|
</view>
|
|
|
<!-- 标题信息栏-end -->
|
|
|
<!-- 产品简介 -->
|
|
|
@@ -109,6 +165,7 @@ import swiperBanner from "@/components/swiperBanner/index.vue";
|
|
|
import uniGoodsNav from "@/components/uni-goods-nav/uni-goods-nav.vue";
|
|
|
import uniNumberBox from "@/components/uni-number-box/uni-number-box.vue";
|
|
|
import authorizeModule from "@/components/authorize-module/index";
|
|
|
+import uniCopy from "@/utils/copy";
|
|
|
export default {
|
|
|
components: {
|
|
|
mpHtml,
|
|
|
@@ -134,42 +191,42 @@ export default {
|
|
|
color: "#fff",
|
|
|
},
|
|
|
],
|
|
|
- btnIndex: 0, // 用户点击按钮事件判断 0:加入购物车;1:立即购买
|
|
|
- type: null, // 商品类型,1零售 2批发 3精品 4今日值买
|
|
|
- goodsId: "", // 商品ID
|
|
|
+ type: null, // 平台类型,1拼多多 2淘宝 3京东 4抖音
|
|
|
id: "", //合伙人套餐ID
|
|
|
detail: {
|
|
|
goods: {},
|
|
|
goods_spec_list: [],
|
|
|
}, // 商品详情
|
|
|
- checked: false, //是否选中协议
|
|
|
- buyNum: 1, //购买数量
|
|
|
- pfway: "1", // 批发
|
|
|
- qhway: "0", //提货方式
|
|
|
shopInfo: {}, // 商铺信息
|
|
|
// showAuth: false,
|
|
|
-
|
|
|
userinfo: {},
|
|
|
goodsDa: {},
|
|
|
unid: "",
|
|
|
- goodsSpecIndex: 0,
|
|
|
- goodsAttrIndex: 0,
|
|
|
- specId: "0",
|
|
|
- attrId: "0",
|
|
|
- afterSpecPrice: 0, // 规格选择后显示价格
|
|
|
goods_price: 0, //到手价
|
|
|
yj_price: 0, // 返利金额
|
|
|
tabs: [],
|
|
|
radio: 0, // 返利比例
|
|
|
+ annual_vol: "", //淘宝销量
|
|
|
+ chabao_ratio: 0, // 茶宝比例
|
|
|
+ coupon_discount: 0, //淘宝商品券
|
|
|
+ promotion_start_time: 0, // 淘宝商品券开始时间
|
|
|
+ promotion_end_time: 0, // 淘宝商品券到期时间
|
|
|
};
|
|
|
},
|
|
|
- onLoad: function (e) {
|
|
|
+ onLoad(e) {
|
|
|
console.log(e);
|
|
|
-
|
|
|
this.userinfo = uni.getStorageSync("userinfo");
|
|
|
let token = uni.getStorageSync("token");
|
|
|
this.type = e.type;
|
|
|
this.goodsDa = e;
|
|
|
+ if (this.type == 2) {
|
|
|
+ this.yj_price = e.yj_price || 0;
|
|
|
+ this.goods_price = e.goods_price || 0;
|
|
|
+ this.annual_vol = e.annual_vol || 0;
|
|
|
+ this.coupon_discount = e.coupon_discount || 0;
|
|
|
+ this.promotion_start_time = e.promotion_start_time;
|
|
|
+ this.promotion_end_time = e.promotion_end_time;
|
|
|
+ }
|
|
|
this.getIcon();
|
|
|
this.loadData(e);
|
|
|
|
|
|
@@ -182,97 +239,149 @@ export default {
|
|
|
post("v1/cashback/getIcon").then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
this.tabs = res.data;
|
|
|
- this.radio = this.tabs[0].ratio
|
|
|
+ let obj = this.tabs.filter((i) => {
|
|
|
+ return i.type == this.type;
|
|
|
+ })[0];
|
|
|
+ this.radio = obj.ratio;
|
|
|
+ this.chabao_ratio = obj.chabao;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
// 商品详情信息
|
|
|
loadData(da) {
|
|
|
- post("v1/cashback/duoduoInfo", da).then((res) => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.detail = JSON.parse(
|
|
|
- res.data
|
|
|
- ).goods_detail_response.goods_details[0];
|
|
|
- this.detail.goods_img = this.detail.goods_gallery_urls;
|
|
|
- this.goods_price =
|
|
|
- Math.floor(
|
|
|
- (this.detail.min_group_price / 100 -
|
|
|
- this.detail.coupon_discount / 100) *
|
|
|
- 100
|
|
|
- ) / 100;
|
|
|
-
|
|
|
- this.yj_price =
|
|
|
- Math.floor(
|
|
|
- (this.detail.min_group_price / 100) *
|
|
|
- (this.detail.promotion_rate / 1000) * this.radio*
|
|
|
- 100
|
|
|
- ) / 100;
|
|
|
-
|
|
|
- this.buttonGroup[1].text =
|
|
|
- "下单省\n¥" + (this.yj_price + this.detail.coupon_discount / 100);
|
|
|
- } else {
|
|
|
- uni.showModal({
|
|
|
- title: "提示",
|
|
|
- content: res.msg,
|
|
|
- showCancel: false,
|
|
|
- success: function (res) {
|
|
|
- if (res) {
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1,
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ if (this.type == 1) {
|
|
|
+ post("v1/cashback/duoduoInfo", da).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.detail = JSON.parse(
|
|
|
+ res.data
|
|
|
+ ).goods_detail_response.goods_details[0];
|
|
|
+ this.detail.goods_img = this.detail.goods_gallery_urls;
|
|
|
+
|
|
|
+ this.goods_price =
|
|
|
+ Math.floor(
|
|
|
+ (this.detail.min_group_price / 100 -
|
|
|
+ this.detail.coupon_discount / 100) *
|
|
|
+ 100
|
|
|
+ ) / 100;
|
|
|
+
|
|
|
+ this.yj_price =
|
|
|
+ Math.floor(
|
|
|
+ (this.detail.min_group_price / 100) *
|
|
|
+ (this.detail.promotion_rate / 1000) *
|
|
|
+ this.radio *
|
|
|
+ 100
|
|
|
+ ) / 100;
|
|
|
+
|
|
|
+ this.buttonGroup[1].text =
|
|
|
+ "下单省\n¥" +
|
|
|
+ (this.yj_price + this.detail.coupon_discount / 100);
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: res.msg,
|
|
|
+ showCancel: false,
|
|
|
+ success: function (res) {
|
|
|
+ if (res) {
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (this.type == 2) {
|
|
|
+ post("v1/cashback/taobaoInfo", da).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.detail = JSON.parse(
|
|
|
+ res.data
|
|
|
+ ).tbk_item_info_get_response.results.n_tbk_item[0];
|
|
|
+ console.log(this.detail, "----");
|
|
|
+
|
|
|
+ this.detail.goods_img = this.detail?.small_images?.string || [
|
|
|
+ this.detail.pict_url,
|
|
|
+ ];
|
|
|
+ console.log(
|
|
|
+ Number(this.detail.reserve_price),
|
|
|
+ Number(this.goods_price),
|
|
|
+ Number(this.yj_price)
|
|
|
+ );
|
|
|
+
|
|
|
+ this.buttonGroup[1].text =
|
|
|
+ "下单省\n¥" +
|
|
|
+ (Number(this.detail.reserve_price) -
|
|
|
+ Number(this.goods_price) +
|
|
|
+ Number(this.yj_price));
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: res.msg,
|
|
|
+ showCancel: false,
|
|
|
+ success: function (res) {
|
|
|
+ if (res) {
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
- // 去购买
|
|
|
- ToPayPage: function () {},
|
|
|
// 点击底部主页购物车等按钮
|
|
|
onClick(e) {
|
|
|
console.log(e, "onClick");
|
|
|
},
|
|
|
// 点击立即购买或加入购物车
|
|
|
buttonClick: function (e) {
|
|
|
+ let _this = this;
|
|
|
if (e.index === 0) {
|
|
|
- // console.log(111);
|
|
|
- // uni.share({
|
|
|
- // provider: "weixin",
|
|
|
- // scene: "WXSceneSession",
|
|
|
- // type: 5,
|
|
|
- // imageUrl: _this.detail.goods_image_url,
|
|
|
- // title: _this.detail.goods_name,
|
|
|
- // miniProgram: {
|
|
|
- // id: "gh_e871cdeb44e1",
|
|
|
- // path: "pagesC/shoppingMallType/p_details",
|
|
|
- // type: 1,
|
|
|
- // webUrl: "",
|
|
|
- // },
|
|
|
- // success: (ret) => {
|
|
|
- // console.log(JSON.stringify(ret));
|
|
|
- // },
|
|
|
- // });
|
|
|
} else {
|
|
|
- let _this = this;
|
|
|
- post("v1/cashback/duoduoZs", {
|
|
|
- goods_sign: _this.detail.goods_sign,
|
|
|
- }).then((res) => {
|
|
|
- if (res.code === 0) {
|
|
|
- let data = JSON.parse(res.data)
|
|
|
- .goods_promotion_url_generate_response
|
|
|
- .goods_promotion_url_list[0];
|
|
|
- console.log(data);
|
|
|
- wx.navigateToMiniProgram({
|
|
|
- shortLink: data.weixin_short_link, //上图找到目标小程序的链接
|
|
|
- //develop开发版;trial体验版;release正式版
|
|
|
- envVersion: "release",
|
|
|
- success(res1) {
|
|
|
- // 打开成功
|
|
|
- console.log("跳转小程序成功!", res1);
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ if (this.type == 1) {
|
|
|
+ post("v1/cashback/duoduoZs", {
|
|
|
+ goods_sign: _this.detail.goods_sign,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ let data = JSON.parse(res.data)
|
|
|
+ .goods_promotion_url_generate_response
|
|
|
+ .goods_promotion_url_list[0];
|
|
|
+ console.log(data);
|
|
|
+ wx.navigateToMiniProgram({
|
|
|
+ shortLink: data.weixin_short_link, //上图找到目标小程序的链接
|
|
|
+ //develop开发版;trial体验版;release正式版
|
|
|
+ envVersion: "release",
|
|
|
+ success(res1) {
|
|
|
+ // 打开成功
|
|
|
+ console.log("跳转小程序成功!", res1);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (this.type == 2) {
|
|
|
+ post("v1/cashback/taobaoUrl", {
|
|
|
+ item_id: _this.detail.input_num_iid,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ let data = JSON.parse(res.data)
|
|
|
+ .tbk_dg_general_link_convert_response.data.item_url_list
|
|
|
+ .item_url_list[0].link_info_dto.coupon_full_tpwd;
|
|
|
+
|
|
|
+ console.log(data);
|
|
|
+ uniCopy({
|
|
|
+ content: data,
|
|
|
+ success: (res) => {
|
|
|
+ uni.showToast({
|
|
|
+ title: "商品链接已复制,请转到淘宝APP查看",
|
|
|
+ icon: "none",
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ error: (e) => {},
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -303,33 +412,33 @@ export default {
|
|
|
});
|
|
|
// #endif
|
|
|
},
|
|
|
- // onauthGetTelSuccess(da) {
|
|
|
- // this.SoHAuth();
|
|
|
- // post("v1/getMobile", {
|
|
|
- // unid: this.unid,
|
|
|
- // ...da.detail,
|
|
|
- // }).then((res) => {
|
|
|
- // if (res.code === 0) {
|
|
|
- // uni.setStorageSync("token", res.data.token);
|
|
|
- // this.getuserInfo();
|
|
|
- // }
|
|
|
- // });
|
|
|
- // },
|
|
|
async getuserInfo() {
|
|
|
this.userinfo = await uni.userfun();
|
|
|
},
|
|
|
},
|
|
|
onShareAppMessage() {
|
|
|
// let userinfo = uni.getStorageSync("userinfo");
|
|
|
- var path = `pagesC/shoppingMallType/p_details?goods_sign=${this.detail.goods_sign}&type=${this.type}`;
|
|
|
- var title = this.detail.goods_name;
|
|
|
- console.log(this.detail.goods_name);
|
|
|
-
|
|
|
- return {
|
|
|
- title: title,
|
|
|
- path: path,
|
|
|
- imageUrl: this.detail.goods_image_url,
|
|
|
- };
|
|
|
+ if (this.type == 1) {
|
|
|
+ var path = `pagesC/shoppingMallType/p_details?goods_sign=${this.detail.goods_sign}&type=${this.type}`;
|
|
|
+ var title = this.detail.goods_name;
|
|
|
+ console.log(this.detail.goods_name);
|
|
|
+
|
|
|
+ return {
|
|
|
+ title: title,
|
|
|
+ path: path,
|
|
|
+ imageUrl: this.detail.goods_image_url,
|
|
|
+ };
|
|
|
+ } else if (this.type == 2) {
|
|
|
+ var path = `pagesC/shoppingMallType/p_details?item_id=${this.detail.input_num_iid}&type=${this.type}&goods_price=${this.goods_price}&yj_price=${this.yj_price}&annual_vol=${this.annual_vol}&coupon_discount=${this.coupon_discount}&promotion_start_time=${this.promotion_start_time}&promotion_end_time=${this.promotion_end_time}`;
|
|
|
+ var title = this.detail.title;
|
|
|
+ console.log(this.detail.goods_name);
|
|
|
+
|
|
|
+ return {
|
|
|
+ title: title,
|
|
|
+ path: path,
|
|
|
+ imageUrl: this.detail.pict_url,
|
|
|
+ };
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -424,7 +533,7 @@ page {
|
|
|
width: 70%;
|
|
|
height: 150rpx;
|
|
|
box-sizing: border-box;
|
|
|
- padding: 0 40rpx;
|
|
|
+ padding: 0 20rpx;
|
|
|
border-radius: 15rpx;
|
|
|
background-color: #ffeff0;
|
|
|
|
|
|
@@ -707,7 +816,11 @@ page {
|
|
|
padding: 0 16rpx;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+.chabao {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #999;
|
|
|
+ padding: 0 20rpx 20rpx;
|
|
|
+}
|
|
|
// 商品规格样式-start
|
|
|
.goods_spec {
|
|
|
font-size: 28rpx;
|