Commit d594f54d authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/viitto/mallapp

Signed-off-by: 罗超's avatar罗超 <alex9012@vip.qq.com>

# Conflicts:
#	plugin/api.js
parents 681a6788 d5a3349c
...@@ -137,6 +137,7 @@ export default { ...@@ -137,6 +137,7 @@ export default {
} }
}, },
joinCar() { joinCar() {
console.log('操作')
this.u = uni.getStorageSync('mall_UserInfo'); this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) { if (!this.u) {
this.u = { this.u = {
...@@ -145,7 +146,10 @@ export default { ...@@ -145,7 +146,10 @@ export default {
}; };
this.showAuth = true; this.showAuth = true;
} else { } else {
this.$emit('join-car'); console.log('传入父组件')
this.$emit('joincar');
} }
}, },
buy() { buy() {
......
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
<view style="width: calc(100vw - 20px); margin-left: 10px; overflow: hidden;"><goodlist :list="recommend"></goodlist></view> <view style="width: calc(100vw - 20px); margin-left: 10px; overflow: hidden;"><goodlist :list="recommend"></goodlist></view>
<u-skeleton v-if="loading" :loading="true" :animation="true" bgcolor="#FFF"></u-skeleton> <u-skeleton v-if="loading" :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> <goodsaction v-if="!loading" :good-name="g.name" :cover-pic="g.cover_pic" :favorite="g.favorite" :good-id="id" @joincar="joinCar" @buy="buy"></goodsaction>
<goodsku <goodsku
v-if="!loading && showSku" v-if="!loading && showSku"
border-radius="10" border-radius="10"
......
...@@ -45,7 +45,10 @@ ...@@ -45,7 +45,10 @@
<view v-if="y.address_disabled"> <view v-if="y.address_disabled">
<u-tag size="mini" text="不在配送范围内" type="warning" /> <u-tag size="mini" text="不在配送范围内" type="warning" />
</view> </view>
<view style="height: 22px;line-height: 22px;font-size: 11px;color: #FF4048;background: #fdf6ec;padding: 0 5px;margin-bottom: 5px;display: inline-block;"> <view v-if="y.freeShipping_Use==true" style="height: 22px;line-height: 22px;font-size: 11px;color: #FF4048;background: #fdf6ec;padding: 0 5px;margin-bottom: 5px;display: inline-block;">
<text>{{y.freeShippingDescription}}</text>
</view>
<view v-if="y.freeShipping_Use==false" style="height: 22px;line-height: 22px;font-size: 11px;color: #909399;background: #f4f4f5;padding: 0 5px;margin-bottom: 5px;display: inline-block;">
<text>{{y.freeShippingDescription}}</text> <text>{{y.freeShippingDescription}}</text>
</view> </view>
...@@ -71,7 +74,7 @@ ...@@ -71,7 +74,7 @@
</view> </view>
</template> </template>
<template> <template>
<view class="goodboxmore" style="font-size: 12px;color: #000000;display: flex;flex-direction: row;align-items: center;flex-wrap: wrap;" v-if="x.pinkageList.length>0"> <view class="goodboxmore" style="font-size: 12px;color: #000000;display: flex;flex-direction: row;flex-wrap: wrap;" v-if="x.pinkageList.length>0 && x.goods_list.length>1 ">
已满足: 已满足:
<view style="height: 22px;line-height: 22px;font-size: 12px;color: #FF4048;background: #fdf6ec;padding: 0 5px;margin-left: 10px;margin-bottom: 5px;" v-for="(y, yi) in x.pinkageList" :key="yi"> <view style="height: 22px;line-height: 22px;font-size: 12px;color: #FF4048;background: #fdf6ec;padding: 0 5px;margin-left: 10px;margin-bottom: 5px;" v-for="(y, yi) in x.pinkageList" :key="yi">
<text>{{y.Name}}</text> <text>{{y.Name}}</text>
......
export default { export default {
install(Vue, options) { install(Vue, options) {
Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285" Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
// Vue.prototype.host2 = "http://192.168.0.110:8200" // Vue.prototype.host2 = "http://192.168.0.110:8200"
Vue.prototype.host2 = "https://mallApi.oytour.com" Vue.prototype.host2 = "https://mallApi.oytour.com"
// Vue.prototype.host2 = "http://192.168.2.16:8088" // Vue.prototype.host2 = "http://192.168.2.16:8088"
//Vue.prototype.host2 = "http://192.168.2.65" // Vue.prototype.host2 = "http://192.168.2.65"
Vue.prototype.request = function(param, success, failed) { Vue.prototype.request = function(param, success, failed) {
//网络请求
uni.request({
url: this.host + "&r=" + param.data.r,
method: param.method || "GET",
header: param.header || {
'content-type': "application/json"
},
data: param.data,
success: res => {
if (res.data.code != 0 && res.data.msg != "商品未上架") {
}
typeof success == "function" && success(res.data);
},
fail: (e) => {
console.log("网络请求fail:" + JSON.stringify(e));
uni.showModal({
content: "" + res.errMsg
});
typeof failed == "function" && failed(res.data);
}
});
}
Vue.prototype.request2 = function(param, success, failed) {
//网络请求 //网络请求
uni.request({ uni.request({
url: this.host + "&r=" + param.data.r, url: this.host2 + param.url,
method: param.method || "GET", method: param.method || "Post",
header: param.header || { header: param.header || {
'content-type': "application/json" 'content-type': "application/json"
}, },
data: param.data, data: {
MallBaseId: 1,
TenantId: 1,
OpenId: this.GetOpenId().OpenId,
UserId: this.GetOpenId().UserId,
MiniAppId: this.GetMiniAppId(),
msg: param.data,
token: this.GetOpenId().token
},
success: res => { success: res => {
if (res.data.code != 0 && res.data.msg != "商品未上架") {
if(res.data.resultCode == 10000){
let u = uni.getStorageSync("mall_UserInfo");
if(u){
this.getLogin_t(u)
typeof failed == "function" && failed(res.data);
}
}else if(res.data.resultCode != 1) {
if( res.data.message!=''){
uni.showToast({
title: res.data.message,
icon: "none",
});
}
typeof failed == "function" && failed(res.data);
}
else{
typeof success == "function" && success(res.data);
} }
typeof success == "function" && success(res.data);
}, },
fail: (e) => { fail: (e) => {
console.log("网络请求fail:" + JSON.stringify(e)); console.log("网络请求fail:" + JSON.stringify(e));
...@@ -29,85 +83,33 @@ export default { ...@@ -29,85 +83,33 @@ export default {
} }
}); });
} }
Vue.prototype.request2 = function(param, success, failed) { // token失效再次登录接口
//网络请求 Vue.prototype.getLogin_t = function(obj) {
uni.request({ let pid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0;
url: this.host2 + param.url, this.request2(
method: param.method || "Post", {
header: param.header || { url: '/api/AppletLogin/Login',
'content-type': "application/json" data: {
}, Source: 1,
data: { OpenId: obj.OpenId,
MallBaseId: 1, Name: obj.Name,
TenantId: 1, Photo: obj.Photo,
OpenId: this.GetOpenId().OpenId, Moblie: '',
UserId: this.GetOpenId().UserId, SuperiorId: pid
MiniAppId: this.GetMiniAppId(), }
msg: param.data, },
token: this.GetOpenId().token res => {
}, if (res.resultCode == 1) {
success: res => { uni.setStorageSync('mall_UserInfo', res.data);
uni.removeStorageSync('pid');
if (res.data.resultCode == 10000) { }
}
let u = uni.getStorageSync("mall_UserInfo"); );
if (u) { }
this.getLogin_t(u) // 获取小程序APPID
typeof failed == "function" && failed(res.data);
}
} else if (res.data.resultCode != 1) {
if (res.data.couponResultCode == 0) {
} else {
uni.showToast({
title: res.data.message,
icon: "none",
});
}
typeof failed == "function" && failed(res.data);
} else {
typeof success == "function" && success(res.data);
}
},
fail: (e) => {
console.log("网络请求fail:" + JSON.stringify(e));
uni.showModal({
content: "" + res.errMsg
});
typeof failed == "function" && failed(res.data);
}
});
}
// token失效再次登录接口
Vue.prototype.getLogin_t = function(obj) {
let pid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
this.request2({
url: '/api/AppletLogin/Login',
data: {
Source: 1,
OpenId: obj.OpenId,
Name: obj.Name,
Photo: obj.Photo,
Moblie: '',
SuperiorId: pid
}
},
res => {
if (res.resultCode == 1) {
uni.setStorageSync('mall_UserInfo', res.data);
uni.removeStorageSync('pid');
}
}
);
}
// 获取小程序APPID
Vue.prototype.GetMiniAppId = function() { Vue.prototype.GetMiniAppId = function() {
return 'wxacd9f8cc3480d29e' return 'wxacd9f8cc3480d29e'
// return 'wxcf0727a7c78b501e' //旅小友 // return 'wxcf0727a7c78b501e' //旅小友
} }
//获取OpenId //获取OpenId
Vue.prototype.GetOpenId = function() { Vue.prototype.GetOpenId = function() {
......
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