Commit e83c1e4a authored by zhengke's avatar zhengke

修改

parent 59e8dfd6
<template>
<view
style="padding: 12px; padding-bottom: 0;width:100%;"
:style="{
'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '',
}"
>
<view
class="good-four"
v-for="(item, gli) in goodList"
:key="gli"
@click="openGood"
:style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background:
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : '',
}"
>
<view class="tips" v-if="goodsInfo.showGoodsTag">
<image
:src="goodsInfo.goodsTagPicUrl"
mode="widthFix"
style="width: 100%;"
/>
</view>
<view class="img-box">
<image
style="width: 100%; height: 100%;"
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
:src="item.picUrl"
/>
</view>
<view class="good-info">
<view class="good-name" v-if="goodsInfo.showGoodsName">{{
item.name
}}</view>
<view class="good-price-info">
<view class="price" :style="{'color':mainColor}">{{
goodsInfo.showGoodsPrice ? item.price : ""
}}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn">
<u-icon
name="cart-o"
size="40"
:color="mainColor"
v-if="goodsInfo.buyBtn == 'cart'"
/>
<u-icon
name="add-o"
size="40"
:color="mainColor"
v-else-if="goodsInfo.buyBtn == 'add'"
/>
<u-button
type="primary"
size="mini"
:ripple="true"
:color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${goodsInfo.buttonColor},color:${
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
"
v-else
>{{ goodsInfo.buyBtnText }}</u-button
>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: ["goodList", "goodsInfo"],
data() {
return {
mainColor: "",
activeKey: 0,
};
},
created() {
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
openGood(e) {
console.log(e);
},
},
};
</script>
<style>
.good-four {
position: relative;
margin-bottom: 14px;
display: flex;
height: 102px;
border: 1rpx solid transparent;
border-radius: 10rpx;
box-sizing: border-box;
padding: 0 1px 1px 0;
overflow: hidden;
}
.good-four .tips {
width: 64rpx;
height: 64rpx;
position: absolute;
top: 0;
left: 0;
z-index: 4;
}
.good-four .img-box {
width: 100px;
height: 100px;
}
.good-four .good-info {
padding: 12px;
flex: 1;
width: 1rpx;
border: 10rpx;
padding-bottom: 0;
display: flex;
flex-direction: column;
/* width:20%; */
}
.good-four .good-info .good-name {
font-size: 13px;
height: 34px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.good-four .good-info .good-price-info {
display: flex;
justify-items: center;
align-items: flex-end;
height: 22px;
flex: 1;
padding-bottom: 10rpx;
}
.good-four .good-info .good-price-info .price {
color: #ff4544;
flex: 1;
font-size: 14px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.good-four .good-info .good-price-info .buy {
width: 24px;
text-align: right;
}
</style>
......@@ -9,6 +9,7 @@
:current="active"
:bar-width="80"
:font-size="32"
:bold="false"
@change="changeHandler"
></u-tabs>
<template v-for="(item, i) in myPageData.home_pages.navs">
......
export default {
install(Vue, options) {
Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
install(Vue, options) {
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://mallapi.oytour.com"
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 != "商品未上架") {
wx.showModal({
content: '网络开小差了,刷新页面重新加载吧',
showCancel: false
})
console.group("发生了异常情况");
console.error(res.data.msg);
console.groupEnd();
} 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);
}
});
}
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 != "商品未上架") {
wx.showModal({
content: '网络开小差了,刷新页面重新加载吧',
showCancel: false
})
console.group("发生了异常情况");
console.error(res.data.msg);
console.groupEnd();
} 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);
}
});
}
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"
}
}
Vue.prototype.request2 = function(param, success, failed) {
//网络请求
uni.request({
url: this.host2 + param.url,
method: param.method || "Post",
header: param.header || {
'content-type': "application/json"
},
data: {
"MallBaseId": 0,
"TenantId": 0,
"OpenId": this.GetOpenId(),
MiniAppId: this.GetMiniAppId(),
msg: param.data
},
success: res => {
if (res.data.resultCode != 1) {
// wx.showModal({
// content: '网络开小差了,刷新页面重新加载吧',
// showCancel: false
// })
console.group("发生了异常情况");
console.error(res.data.msg);
console.groupEnd();
} 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.GetMiniAppId = function() {
return 'wxacd9f8cc3480d29e'
}
//获取OpenId
Vue.prototype.GetOpenId = function() {
return 'ow_7I5ZQKhAB66yvOTGI35Xk-Kmg'
}
//公用判断图片地址 判断是否包含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;
}
}
// Vue.prototype.post = function(obj, success, failed) {
// this.sendRequest(obj.url, 'POST', obj.data, success, failed)
// }
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"
}
}
// Vue.prototype.get = function(obj, success, failed) {
// this.sendRequest(obj.url, 'GET', obj.data, success, failed)
// }
}
}
\ No newline at end of file
// Vue.prototype.post = function(obj, success, failed) {
// this.sendRequest(obj.url, 'POST', obj.data, success, failed)
// }
// Vue.prototype.get = function(obj, success, failed) {
// this.sendRequest(obj.url, 'GET', obj.data, success, failed)
// }
}
}
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