Commit 25ea6751 authored by zhangjianguo's avatar zhangjianguo

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

parents 29f1fb22 70955046
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
"delay" : 0 "delay" : 0
}, },
/* 模块配置 */ /* 模块配置 */
"modules" : {}, "modules" : {
"Share" : {}
},
/* 应用发布信息 */ /* 应用发布信息 */
"distribute" : { "distribute" : {
/* android打包配置 */ /* android打包配置 */
...@@ -50,7 +52,14 @@ ...@@ -50,7 +52,14 @@
/* ios打包配置 */ /* ios打包配置 */
"ios" : {}, "ios" : {},
/* SDK配置 */ /* SDK配置 */
"sdkConfigs" : {} "sdkConfigs" : {
"share" : {
"weixin" : {
"appid" : "wxacd9f8cc3480d29e",
"UniversalLinks" : ""
}
}
}
} }
}, },
/* 快应用特有相关 */ /* 快应用特有相关 */
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</template> </template>
<script> <script>
import auth from "../../components/auth/index.vue"; import auth from "@/components/auth/index";
export default { export default {
props: ['coverPic', 'goodName', 'favorite', 'goodId'], props: ['coverPic', 'goodName', 'favorite', 'goodId'],
data() { data() {
......
<template>
<u-popup
mode="bottom"
:border-radius="20"
:popup="false"
v-model="value"
:maskCloseAble="true"
length="auto"
:safeAreaInsetBottom="true"
@close="popupClose"
:z-index="9999"
close-icon="close"
>
<view class="share-box" :style="{ paddingBottom: bianyi ? '50rpx' : '0' }">
<view class="title">分享商品</view>
<view class="goodname">{{ goodName }}</view>
<view class="img-box">
<view class="box">
<image
v-for="(x, i) in images"
:key="i"
:src="x.pic_url"
class="img"
mode="aspectFill"
@click="previewImage(i)"
/>
</view>
</view>
<view class="op-box">
<view class="left">
<text @click="copyHandler">复制文本</text>
<text @click="savePicHandler" style="text-align: center;"
>保存图片</text
>
<text @click="genernalHandler" style="text-align: right;"
>生成海报</text
>
</view>
<view class="right">
<text>分享到</text>
<image
src="/static/images/icon/quan.png"
style="width: 24px; height: 24px;"
@click="sendQuanHandler"
/>
<!-- #ifdef MP-WEIXIN -->
<button open-type="share" style="border: none; outline: none;">
<image
src="/static/images/icon/friend.png"
style="width: 24px; height: 24px;"
/>
</button>
<!-- #endif -->
</view>
</view>
</view>
<u-top-tips ref="uTips"></u-top-tips>
</u-popup>
</template>
<script>
export default {
model: {},
props: {
value: {
type: Boolean,
default: true,
},
id: {
type: Number,
default: 0,
},
goodName: {
type: String,
default: "",
},
images: {
type: Array,
default: [],
},
},
data() {
return {
bianyi: false,
};
},
mounted() {
this.bianyi = this.$uiConfig.is_bang;
},
methods: {
popupClose(){
this.$emit('close')
},
savePicHandler() {
uni.showLoading({
title: "正在下载图片",
});
let arr = JSON.parse(JSON.stringify(this.images));
this.downLoadImage(arr);
},
genernalHandler() {
uni.navigateTo({
url: "/pages/goods/draw",
});
},
sendQuanHandler() {
this.copyHandler();
setTimeout(() => {
this.savePicHandler();
}, 1000);
},
downLoadImage(arr) {
let that = this;
uni.downloadFile({
url: arr[0].pic_url,
success: (res) => {
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function () {
arr.splice(0, 1);
if (arr.length > 0) {
that.downLoadImage(arr);
} else {
uni.hideLoading();
uni.showToast({
title: "下载成功",
});
}
},
fail: function (e) {
uni.hideLoading();
that.$refs.uTips.show({
title: "下载失败,请稍后重试",
type: "error",
duration: "2300",
});
},
});
} else {
uni.hideLoading();
that.$refs.uTips.show({
title: "下载失败,请稍后重试",
type: "error",
duration: "2300",
});
}
},
});
},
copyHandler() {
uni.setClipboardData({
data: this.goodName,
});
},
previewImage(i) {
uni.previewImage({
urls: this.imgs,
current: i,
longPressActions: {
itemList: ["发送给朋友", "保存图片", "收藏"],
success: function (data) {},
fail: function (err) {
console.log(err.errMsg);
},
},
});
},
},
};
</script>
<style>
.share-box {
position: relative;
padding: 20rpx;
padding-bottom: 0;
}
.share-box .title {
font-size: 40rpx;
color: #000;
margin-bottom: 50rpx;
font-weight: 600;
}
.share-box .goodname {
font-size: 28rpx;
line-height: 1.5;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
color: #333;
}
.share-box .img-box {
margin-top: 40rpx;
padding-bottom: 40rpx;
display: block;
border-bottom: 2rpx solid #f1f1f1;
}
.share-box .img-box .box {
white-space: nowrap;
}
.share-box .img-box .box .img {
display: inline-block;
width: 252rpx;
height: 252rpx;
border-radius: 8rpx;
margin-right: 20rpx;
}
.share-box .op-box {
display: flex;
margin: 20rpx 0;
align-items: center;
font-size: 14px;
color: gray;
}
.share-box .op-box .left {
display: flex;
flex: 1;
width: 1rpx;
align-items: center;
}
.share-box .op-box .left text {
flex: 1;
text-align: left;
width: 1rpx;
}
.share-box .op-box .right {
margin-left: 20rpx;
border-left: 2rpx solid #f1f1f1;
display: flex;
align-items: center;
}
.share-box .op-box .right text,
.share-box .op-box .right image {
margin-left: 20rpx;
}
.share-box .op-box .right button {
border: none;
outline: none;
padding: 0;
width: 68rpx;
height: 48rpx;
margin: 0;
line-height: unset;
}
.share-box .op-box .right button::after {
border: none;
}
</style>
...@@ -287,7 +287,7 @@ export default { ...@@ -287,7 +287,7 @@ export default {
this.info = res.data.info; this.info = res.data.info;
this.loading = false; this.loading = false;
this.generterConfig.bgColor = this.config.color[0]; this.generterConfig.bgColor = this.config.color[0];
let temp = 1; //parseInt(this.config.image_style[0]); let temp = parseInt(this.config.image_style[0]);
for (let i = 0; i < temp; i++) { for (let i = 0; i < temp; i++) {
this.generterConfig.images.push(this.info.multi_map[i]); this.generterConfig.images.push(this.info.multi_map[i]);
} }
......
...@@ -28,11 +28,15 @@ ...@@ -28,11 +28,15 @@
<!-- 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'">{{ g.original_price }}</text> <text class="oprice" v-if="setting.is_underline_price == '1'">{{
<text v-if="setting.is_sales=='1'">已售出{{ g.sales }}{{ g.unit }}</text> g.original_price
}}</text>
<text v-if="setting.is_sales == '1'"
>已售出{{ g.sales }}{{ g.unit }}</text
>
</view> </view>
</view> </view>
<view class="right u-skeleton-rect"> <view class="right u-skeleton-rect" @click="openShare">
<image <image
src="@/static/images/icon/icon-share.png" src="@/static/images/icon/icon-share.png"
class="share-icon" class="share-icon"
...@@ -61,14 +65,21 @@ ...@@ -61,14 +65,21 @@
<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">{{ currentSku.attr_list.length>0 ? "已" : "请" }}选择 {{ sku }} </view> <view class="sku"
>{{ currentSku.attr_list.length > 0 ? "已" : "请" }}选择 {{ sku }}
</view>
<view class="arrow"> <view class="arrow">
<u-icon name="arrow" :size="32" color="#111"></u-icon> <u-icon name="arrow" :size="32" color="#111"></u-icon>
</view> </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 v-for="(x, i) in skuimage" class="item img" style="margin-bottom:5px" :key="i"> <view
v-for="(x, i) in skuimage"
class="item img"
style="margin-bottom: 5px;"
:key="i"
>
<image :src="x" style="width: 100%; height: 100%;" /> <image :src="x" style="width: 100%; height: 100%;" />
</view> </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"
...@@ -79,7 +90,12 @@ ...@@ -79,7 +90,12 @@
</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 class="item" v-if="i<5" :key="i" style="margin-bottom:5px"> <view
class="item"
v-if="i < 5"
:key="i"
style="margin-bottom: 5px;"
>
{{ x.attr_name }} {{ x.attr_name }}
</view> </view>
</template> </template>
...@@ -94,7 +110,7 @@ ...@@ -94,7 +110,7 @@
</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 }} {{ g.express == "" ? "免运费" : g.express }}
...@@ -123,7 +139,7 @@ ...@@ -123,7 +139,7 @@
<view <view
class="sku-box u-skeleton-rect" class="sku-box u-skeleton-rect"
v-if="comments.comments.length == 0 && setting.is_comment=='1'" v-if="comments.comments.length == 0 && setting.is_comment == '1'"
> >
<view class="label">暂无评论信息</view> <view class="label">暂无评论信息</view>
</view> </view>
...@@ -202,15 +218,23 @@ ...@@ -202,15 +218,23 @@
mode="favor" mode="favor"
v-if="!isExsitGoods" v-if="!isExsitGoods"
></u-empty> ></u-empty>
<share
:id="id"
v-if="showShare"
:good-name="g.name"
:images="g.pic_url"
@close="closeShare"
></share>
<!-- <auth></auth> --> <!-- <auth></auth> -->
</view> </view>
</template> </template>
<script> <script>
import goodlist from "@/components/goods/list"; import goodlist from "@/components/goods/list";
import goodsaction from "@/components/goods/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 share from "./components/share/share";
export default { export default {
data() { data() {
return { return {
...@@ -230,10 +254,11 @@ export default { ...@@ -230,10 +254,11 @@ export default {
currentSku: {}, currentSku: {},
isExsitGoods: true, isExsitGoods: true,
pageTitle: "商品详情", pageTitle: "商品详情",
setting:{}, setting: {},
prevPage:"", prevPage: "",
//自定义接手传递 //自定义接手传递
opTionObj:{} opTionObj: {},
showShare:false
}; };
}, },
components: { components: {
...@@ -241,16 +266,24 @@ export default { ...@@ -241,16 +266,24 @@ export default {
goodsaction, goodsaction,
goodsku, goodsku,
auth, auth,
share,
}, },
onLoad(option) { onLoad(option) {
console.log(option,'optionnnn'); console.log(option, "optionnnn");
this.opTionObj=option; this.opTionObj = option;
this.id = option.GoodsId ? option.GoodsId : 46942; //40887 59512 46942 this.id = option.GoodsId ? option.GoodsId : 29; //40887 59512 46942
this.init(); this.init();
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary; this.secondary = this.$uiConfig.secondary;
this.initPage(); this.initPage();
this.setting = uni.getStorageSync("basedata").setting this.setting = uni.getStorageSync("basedata").setting;
},
onShareAppMessage(res) {
return {
title: this.g.name,
path: "/pages/goods/goods?id" + this.id,
imageUrl: this.g.pic_url[0].pic_url,
};
}, },
methods: { methods: {
initPage() { initPage() {
...@@ -279,11 +312,11 @@ export default { ...@@ -279,11 +312,11 @@ export default {
{ {
url: "/api/AppletGoods/GetAppletGoodsInfo", url: "/api/AppletGoods/GetAppletGoodsInfo",
data: { data: {
GoodsId: this.opTionObj.GoodsId GoodsId: this.id,
}, },
}, },
(res) => { (res) => {
console.log(res,'详情'); console.log(res, "详情");
if (res.resultCode == 1) { if (res.resultCode == 1) {
this.g = res.data.goods; this.g = res.data.goods;
this.g.pic_url.forEach((x) => { this.g.pic_url.forEach((x) => {
...@@ -302,12 +335,15 @@ export default { ...@@ -302,12 +335,15 @@ export default {
}); });
console.log(this.skuimage); console.log(this.skuimage);
var richtext = this.g.detail; var richtext = this.g.detail;
richtext = richtext.replace(/<img/g, '<img style="max-width:100%;height:auto !important;"'); richtext = richtext.replace(
/<img/g,
'<img style="max-width:100%;height:auto !important;"'
);
this.detailContent = richtext; this.detailContent = richtext;
this.loading = false; this.loading = false;
this.initComments(); this.initComments();
this.initRecommend(); this.initRecommend();
this.setFootMarkInfo(res.data.goods.id) this.setFootMarkInfo(res.data.goods.id);
} else { } else {
this.isExsitGoods = false; this.isExsitGoods = false;
} }
...@@ -365,19 +401,17 @@ export default { ...@@ -365,19 +401,17 @@ 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() {
this.showSku = true; this.showSku = true;
this.ot = 0; this.ot = 0;
...@@ -409,6 +443,12 @@ export default { ...@@ -409,6 +443,12 @@ export default {
}); });
} }
}, },
closeShare() {
this.showShare = false;
},
openShare() {
this.showShare = true;
},
}, },
}; };
</script> </script>
......
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 = "https://mallApi.oytour.com"
//Vue.prototype.host2 = "https://mallApi.oytour.com" //Vue.prototype.host2 = "https://mallApi.oytour.com"
//Vue.prototype.host2 = "http://mallapi.oytour.com" //Vue.prototype.host2 = "http://mallapi.oytour.com"
Vue.prototype.request = function(param, success, failed) { Vue.prototype.request = function(param, success, failed) {
//网络请求 //网络请求
uni.request({ uni.request({
url: this.host + "&r=" + param.data.r, url: this.host + "&r=" + param.data.r,
method: param.method || "GET", method: param.method || "GET",
header: param.header || { header: param.header || {
'content-type': "application/json" 'content-type': "application/json"
}, },
data: param.data, data: param.data,
success: res => { success: res => {
if (res.data.code != 0 && res.data.msg != "商品未上架") { 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) { }
//网络请求 typeof success == "function" && success(res.data);
uni.request({ },
url: this.host2 + param.url, fail: (e) => {
method: param.method || "Post", console.log("网络请求fail:" + JSON.stringify(e));
header: param.header || { uni.showModal({
'content-type': "application/json" content: "" + res.errMsg
}, });
data: { typeof failed == "function" && failed(res.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 => {
if (res.data.resultCode != 1) {
} 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);
}
});
}
// 获取小程序APPID Vue.prototype.request2 = function(param, success, failed) {
Vue.prototype.GetMiniAppId = function() { //网络请求
return 'wxacd9f8cc3480d29e' uni.request({
} url: this.host2 + param.url,
//获取OpenId method: param.method || "Post",
Vue.prototype.GetOpenId = function() { header: param.header || {
let mall_userinfo = wx.getStorageSync('mall_UserInfo') 'content-type': "application/json"
var obj = { },
OpenId: '', data: {
UserId: 0, MallBaseId: 1,
token:'' TenantId: 1,
} OpenId: this.GetOpenId().OpenId,
if (mall_userinfo) { UserId: this.GetOpenId().UserId,
if (mall_userinfo.OpenId) { MiniAppId: this.GetMiniAppId(),
obj.OpenId = mall_userinfo.OpenId; msg: param.data,
obj.UserId = mall_userinfo.UserId; token: this.GetOpenId().token
obj.token = mall_userinfo.Token; },
} success: res => {
} if (res.data.resultCode != 1) {
return obj
}
//公用判断图片地址 判断是否包含http
Vue.prototype.getIconLink = function(url) {
let str = ''
if (url && url != '') {
if (url.indexOf('http') != -1) {
str = url
} else {
str = 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com' + url;
}
return str;
}
}
//价格返回.00
Vue.prototype.getPrice = function(val) {
val = Number(val).toFixed(2);
return val
}
Vue.prototype.apiheader = function() { } else {
return { typeof success == "function" && success(res.data);
'X-Access-Token': '_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr', }
'X-App-Platform': 'wxapp', },
'X-App-Version': '4.2.47', fail: (e) => {
'X-Form-Id-List': '[]', console.log("网络请求fail:" + JSON.stringify(e));
'X-Requested-With': 'XMLHttpRequest', uni.showModal({
'X-User-Id': '19992', content: "" + res.errMsg
'content-type': "application/json" });
} typeof failed == "function" && failed(res.data);
} }
} });
} }
// 获取小程序APPID
Vue.prototype.GetMiniAppId = function() {
return 'wxacd9f8cc3480d29e'
}
//获取OpenId
Vue.prototype.GetOpenId = function() {
let mall_userinfo = wx.getStorageSync('mall_UserInfo')
var obj = {
OpenId: '',
UserId: 0,
token: ''
}
if (mall_userinfo) {
if (mall_userinfo.OpenId) {
obj.OpenId = mall_userinfo.OpenId;
obj.UserId = mall_userinfo.UserId;
obj.token = mall_userinfo.Token;
}
}
return obj
}
//公用判断图片地址 判断是否包含http
Vue.prototype.getIconLink = function(url) {
let str = ''
if (url && url != '') {
if (url.indexOf('http') != -1) {
str = url
} else {
str = 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com' + url;
}
return str;
}
}
//价格返回.00
Vue.prototype.getPrice = function(val) {
val = Number(val).toFixed(2);
return val
}
Vue.prototype.apiheader = function() {
return {
'X-Access-Token': '_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr',
'X-App-Platform': 'wxapp',
'X-App-Version': '4.2.47',
'X-Form-Id-List': '[]',
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': '19992',
'content-type': "application/json"
}
}
}
}
\ No newline at end of file
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