Commit a7895cad authored by Mac's avatar Mac

司导分享

parent 35cd5e0e
......@@ -288,30 +288,6 @@ export default {
this.generterConfig.bgType = this.types[v].clsName == "fill" ? 1 : 2;
}
},
// init() {
// let h = this.apiheader();
// this.request(
// {
// url: "",
// header: h,
// data: {
// r: "plugin/quick_share/api/poster/config",
// goods_id: this.id,
// },
// },
// (res) => {
// this.config = res.data.config;
// this.info = res.data.info;
// this.loading = false;
// this.generterConfig.bgColor = this.config.color[0];
// let temp = parseInt(this.config.image_style[0]);
// for (let i = 0; i < temp; i++) {
// this.generterConfig.images.push(this.info.multi_map[i]);
// }
// this.newInit();
// }
// );
// },
init() {
let u = uni.getStorageSync("mall_UserInfo");
let SmallShopId = uni.getStorageSync("mall_UserInfo")
......@@ -330,8 +306,8 @@ export default {
goodsId: this.id,
// path: "/pages/goods/goods?id=" + this.id + "&user_id=" + u.UserId,
path: "/pages/index/index?id=" + this.id + "&user_id=" + u.UserId+ "&SmallShopId=" + SmallShopId
+'&address='+this.address
+'&Pickcar='+this.Pickcar
+'&address='+encodeURIComponent(JSON.stringify(this.address))
+'&Pickcar='+encodeURIComponent(JSON.stringify(this.Pickcar))
+'&StartTime='+this.StartTime
+'&EndTime='+this.EndTime
+'&JumpType=3',
......
......@@ -128,10 +128,11 @@ export default {
},
genernalHandler() {
//this.goodId
console.log(this.address,this.pickcar,this.startTime,this.endTime)
uni.navigateTo({
url: "/pages/guidecar/components/guidecarDraw?id="+this.goodId
+'&address='+this.address
+'&Pickcar='+this.pickcar
+'&StartTime='+this.startTime
+'&EndTime='+this.endTime
});
......
......@@ -229,16 +229,24 @@
:advertising="g.advertising"
@close="closeShare"
></share>
<coupon
v-if="showCoupons"
:coupon-message="couponMessage"
@goLook="goLook"
@closeBtn="closeBtn"
></coupon>
</view>
</template>
<script>
import hParse from "@/components/u-parse/parse.vue";
import share from "./components/guidecarShare.vue";
import coupon from "@/components/coupons/coupons";
export default {
components: {
hParse,
share
share,
coupon
},
data() {
return {
......@@ -262,12 +270,31 @@
Pickcar:'',
StartTime:"",
EndTime:'',
couponMessage: "",//弹出优惠券的内容
showCoupons: false,
SmallShopId:0,//分享微店id
uid:0,//分享的上级id
}
},
onLoad(option){
console.log(option,'option')
if(option && option.GoodsId){
this.GoodsId = option.GoodsId
}
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.user_id) {
uni.setStorageSync("pid", { pid: option.user_id });
}
if (option && option.SmallShopId) {
uni.setStorageSync("SmallShopId", { SmallShopId: option.SmallShopId });
}
if(option && option.address){
this.address = option.address
}
......@@ -282,6 +309,7 @@
this.ETime = this.getTime(option.EndTime)
this.EndTime= option.EndTime
}
if(option&& option.StartTime && option.EndTime){
let startTime = new Date(option.StartTime); // 开始时间
let endTime = new Date(option.EndTime); // 结束时间
......@@ -308,8 +336,67 @@
this.init()//商品详情
this.getAppletGoodsCommentPageList()//获取商品评论数
let u = uni.getStorageSync("mall_UserInfo");
let uid = u.UserId ? u.UserId : 0;
this.path = '/pages/index/index?id=' + this.GoodsId + "&user_id=" + uid+'&JumpType=3';
this.uid = u.UserId ? u.UserId : 0;
this.SmallShopId = uni.getStorageSync("mall_UserInfo")? uni.getStorageSync("mall_UserInfo").SmallShopId: 0;
if(this.SmallShopId == 0){//如果微店id为0 去找所属微店id
this.SmallShopId = uni.getStorageSync("mall_UserInfo")? uni.getStorageSync("mall_UserInfo").UserSmallShopId: 0;
}
this.path = "/pages/index/index?GoodsId=" + this.GoodsId + "&user_id=" + this.uid+ "&SmallShopId=" + this.SmallShopId+'&JumpType=3'
+'&address='+encodeURIComponent(JSON.stringify(this.address))
+'&Pickcar='+encodeURIComponent(JSON.stringify(this.Pickcar))
+'&StartTime='+this.StartTime
+'&EndTime='+this.EndTime;
wx.showShareMenu({
withShareTicket: true,
menus: ["shareAppMessage", "shareTimeline"],
});
},
onShareTimeline() {
setTimeout(() => {
console.log("分享朋友圈调用");
this.getReceive();
}, 2500);
if(this.uid==0){
this.uid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid: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;
return {
title: title,
query: "GoodsId=" + this.GoodsId + "&user_id=" + this.uid+ "&SmallShopId=" + this.SmallShopId
+'&address='+this.address
+'&Pickcar='+this.Pickcar
+'&StartTime='+this.StartTime
+'&EndTime='+this.EndTime,
imageUrl: imageUrl,
};
},
onShareAppMessage(res) {
setTimeout(() => {
console.log("分享好友调用");
this.getReceive();
}, 2500);
if(this.uid==0){
this.uid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0
}
return {
title: this.g.app_share_title != null && this.g.app_share_title != "" ? this.g.app_share_title : this.g.name,
path: "/pages/index/index?GoodsId=" + this.GoodsId + "&user_id=" + this.uid+ "&SmallShopId=" + this.SmallShopId+'&JumpType=3'
+'&address='+encodeURIComponent(JSON.stringify(this.address))
+'&Pickcar='+encodeURIComponent(JSON.stringify(this.Pickcar))
+'&StartTime='+this.StartTime
+'&EndTime='+this.EndTime,
imageUrl:
this.g.app_share_pic != null && this.g.app_share_pic != ""
? this.g.app_share_pic
: this.g.pic_url[0].pic_url,
};
},
created(){
......@@ -346,6 +433,7 @@
this.g.pic_url.forEach((x) => {
this.imgs.push(x.pic_url);
});
this.g.marketingLogo = JSON.parse(this.g.marketingLogo);
this.isAllowShare = res.data.goods.isAllowShare; //1为可以分享 2为不能分享
if (this.isAllowShare == 2) {
//隐藏分享的按钮
......@@ -459,7 +547,35 @@
})
}
},
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;
},
}
}
......@@ -475,6 +591,22 @@
background: #fff;
padding: 10px;
}
.guidecarOrderdetails .g-name{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 16px;
height: 45px;
}
.guidecarOrderdetails .Logo {
padding: 1px 5px;
display: inline-block;
font-size: 22rpx;
margin-right: 5rpx;
border-radius: 4px;
}
.guidecarOrderdetails .g-info .g-price-box {
display: flex;
align-items: flex-end;
......
......@@ -162,6 +162,7 @@ export default {
loading: "努力加载中",
nomore: "没有更多了",
},
PagePath:'',
};
},
......@@ -216,6 +217,7 @@ export default {
this.getCarClassList()//车辆类型
this.init();
this.getGuideCarBrandList()//车辆品牌
this.getPagePath()//获取详情跳转详情地址
},
created() {
this.mainColor = this.$uiConfig.mainColor;
......@@ -345,13 +347,35 @@ getGuideCarBrandList(){
this.init()
},
getPagePath(){
this.request2(
{
url: "/api/AppletGuideCar/GetGuideCarInfoForPagePath",
data: {},
},
(res) => {
if(res.resultCode==1){
this.PagePath = res.data.PagePath
}
}
);
},
goDetails(x){//跳转商品详情
if(this.PagePath!=''){
uni.navigateTo({
url:'/pages/guidecar/guidecarGoodsdetails?GoodsId='+x.id +'&address='+this.address+'&Pickcar='+this.Pickcar+
'&StartTime='+this.msg.StartTime+
'&EndTime='+this.msg.EndTime
url:this.PagePath+'?GoodsId='+x.id +'&address='+this.address+'&Pickcar='+this.Pickcar+
'&StartTime='+this.msg.StartTime+
'&EndTime='+this.msg.EndTime
})
}else{//如果没有跳转地址的时候 默认
uni.navigateTo({
url:'/pages/guidecar/guidecarGoodsdetails?GoodsId='+x.id +'&address='+this.address+'&Pickcar='+this.Pickcar+
'&StartTime='+this.msg.StartTime+
'&EndTime='+this.msg.EndTime
})
}
},
lower(e) {
......
......@@ -131,6 +131,7 @@ export default {
shopData: {},
JumpType: 0,
GoodsId: 29,
guidecar:{},
};
},
components: {
......@@ -208,7 +209,7 @@ export default {
uni.setStorageSync("SmallShopId", { SmallShopId: options.SmallShopId });
console.log(uni.getStorageSync("SmallShopId"));
}
if (options && options.scene) {
//兼容之前小程序的调转
this.getjump(options.scene);
......@@ -220,8 +221,15 @@ export default {
menus: ["shareAppMessage", "shareTimeline"],
});
if (options && options.JumpType) {
//跳转类型 1为详情2为直播列表
//跳转类型 1为详情2为直播列表3为司导
this.JumpType = options.JumpType;
if(options.JumpType == 3){
this.guidecar.GoodsId = options.GoodsId;
this.guidecar.address = options.address?JSON.parse(decodeURIComponent(options.address)):'';
this.guidecar.Pickcar = options.Pickcar?JSON.parse(decodeURIComponent(options.Pickcar)):'';
this.guidecar.StartTime = options.StartTime?options.StartTime:'';
this.guidecar.EndTime = options.EndTime?options.EndTime:'';
}
}
if (options && options.id) {
//商品详情
......@@ -250,6 +258,9 @@ export default {
} else if (that.JumpType == 2) {
//直播列表
uni.navigateTo({ url: "/pages/live/index" });
}else if (that.JumpType == 3) {
//司导详情
that.goguidecar()
}
}, 500);
} else {
......@@ -444,7 +455,10 @@ export default {
} else if (that.JumpType == 2) {
//直播列表
uni.navigateTo({ url: "/pages/live/index" });
}
}else if (that.JumpType == 3) {
//司导详情
that.goguidecar()
}
}, 500);
} else {
if (!that.u) {
......@@ -743,13 +757,23 @@ export default {
} else if (this.JumpType == 2) {
//直播列表
uni.navigateTo({ url: "/pages/live/index" });
}
}else if (this.JumpType == 3) {
//司导详情
this.goguidecar()
}
}, 500);
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
},
goguidecar(){
uni.navigateTo({
url:'/pages/guidecar/guidecarGoodsdetails?GoodsId='+this.guidecar.GoodsId +'&address='+this.guidecar.address+'&Pickcar='+this.guidecar.Pickcar+
'&StartTime='+this.guidecar.StartTime+
'&EndTime='+this.guidecar.EndTime
})
}
},
};
</script>
......
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