Commit 10bd72ba authored by zhengke's avatar zhengke

修改

parent 0996b060
...@@ -21,9 +21,7 @@ ...@@ -21,9 +21,7 @@
</view> </view>
<view class="amount">库存 {{ goodamount }} {{ g.unit }}</view> <view class="amount">库存 {{ goodamount }} {{ g.unit }}</view>
<view class="sku">{{ skuObj ? '已选择' : '选择' }} {{ sku }}</view> <view class="sku">{{ skuObj ? '已选择' : '选择' }} {{ sku }}</view>
<view class="sku_close"> <view class="sku_close"><u-icon name="cross" color="#9F9F9F" @click="cloGood()" size="40" /></view>
<u-icon name="cross" color="#9F9F9F" @click="cloGood()" size="40"/>
</view>
</view> </view>
</view> </view>
<view class="sku-box"> <view class="sku-box">
...@@ -204,7 +202,7 @@ export default { ...@@ -204,7 +202,7 @@ export default {
GoodsId: this.skuObj.goods_id, GoodsId: this.skuObj.goods_id,
SpecificationSort: this.skuObj.sign_id, SpecificationSort: this.skuObj.sign_id,
Number: this.gc == 0 ? 1 : this.gc Number: this.gc == 0 ? 1 : this.gc
}, }
}, },
res => { res => {
uni.showToast({ uni.showToast({
...@@ -225,38 +223,27 @@ export default { ...@@ -225,38 +223,27 @@ export default {
} }
}, },
buy() { buy() {
let ShoppingCartIdList=[]; let ShoppingCartIdList = [];
if (this.skuObj && this.skuObj.id) { if (this.skuObj && this.skuObj.id) {
let good = { let good = {
DetailList: [], DetailList: [],
Use_Integral: 0, Use_Integral: 0,
User_Coupon_Id: 0, User_Coupon_Id: 0,
DeliveryMethod:0, DeliveryMethod: 0,
AddressId:0, AddressId: 0
}; };
let g = { let g = {
GoodsId: this.skuObj.goods_id, GoodsId: this.skuObj.goods_id,
Number: this.gc, Number: this.gc,
SpecificationSort: this.skuObj.sign_id, SpecificationSort: this.skuObj.sign_id
}; };
good.DetailList.push(g); good.DetailList.push(g);
// let g = {
// id: this.skuObj.goods_id,
// num: this.gc,
// cart_id: 0,
// goods_attr_id: this.skuObj.id,
// attr: []
// };
// this.skuObj.attr_list.forEach(x => {
// g.attr.push({
// attr_id: x.attr_id,
// attr_group_id: x.attr_group_id
// });
// });
// this.forms.list[0].goods_list.push(g);
// this.forms.list[0].mch_id = this.g.mch_id;
uni.navigateTo({ uni.navigateTo({
url: '/pages/order-submit/order-submit?formData=' + encodeURIComponent(JSON.stringify(good))+'&IsFormShoppingCart=2&ShoppingCartIdList='+JSON.stringify(ShoppingCartIdList), url:
'/pages/order-submit/order-submit?formData=' +
encodeURIComponent(JSON.stringify(good)) +
'&IsFormShoppingCart=2&ShoppingCartIdList=' +
JSON.stringify(ShoppingCartIdList),
complete(res) { complete(res) {
console.log(res); console.log(res);
} }
...@@ -423,7 +410,7 @@ export default { ...@@ -423,7 +410,7 @@ export default {
width: 1px; width: 1px;
position: relative; position: relative;
} }
.goodsku .chosen-info .sku_close{ .goodsku .chosen-info .sku_close {
position: absolute; position: absolute;
right: 4px; right: 4px;
top: 5px; top: 5px;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<div <div
...@@ -13,17 +13,10 @@ ...@@ -13,17 +13,10 @@
@click="openGood(item)" @click="openGood(item)"
:style="{ :style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background: background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : '',
}" }"
> >
<div class="tips" v-if="goodsInfo.showGoodsTag"> <div class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width: 100%;" /></div>
<image
:src="goodsInfo.goodsTagPicUrl"
mode="widthFix"
style="width: 100%;"
/>
</div>
<image <image
style="width: calc(100vw - 24px); height: 66vw;" style="width: calc(100vw - 24px); height: 66vw;"
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
...@@ -41,66 +34,52 @@ ...@@ -41,66 +34,52 @@
:src="item.picUrl" :src="item.picUrl"
/> />
<div class="good-info"> <div class="good-info">
<div class="good-name" v-if="goodsInfo.showGoodsName"> <div class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</div>
{{ item.name }}
</div>
<div class="good-price-info"> <div class="good-price-info">
<span class="price" :style="{ color: mainColor }">{{ <span class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</span>
goodsInfo.showGoodsPrice ? getPrice(item.price) : ""
}}</span>
<span class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)"> <span class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
name="cart-o" <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
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 <u-button
type="primary" type="primary"
size="mini" size="mini"
:ripple="true" :ripple="true"
:color="goodsInfo.buttonColor" :color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${goodsInfo.buttonColor},color:${ :custom-style="
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 `backgroundColor:${goodsInfo.buttonColor},color:${goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'}`
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
" "
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
v-else v-else
>{{ goodsInfo.buyBtnText }}</u-button
> >
{{ goodsInfo.buyBtnText }}
</u-button>
</span> </span>
</div> </div>
</div> </div>
</div> </div>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku> <good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</div> </div>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku' import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
components:{ components: {
goodSku goodSku,
auth
}, },
props: ["goodList", "goodsInfo"], props: ['goodList', 'goodsInfo'],
data() { data() {
return { return {
mainColor: "", mainColor: '',
activeKey: 0, activeKey: 0,
showSku:false, showSku: false,
sku:{} sku: {},
showAuth: false,
u: {}
}; };
}, },
created() { created() {
...@@ -108,13 +87,30 @@ export default { ...@@ -108,13 +87,30 @@ export default {
}, },
methods: { methods: {
openGood(item) { openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
}, },
showSkuHandler(g){ showSkuHandler(g) {
this.sku=g this.sku = g;
this.showSku=true this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
} }
}, },
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </script>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<u-row gutter="24"> <u-row gutter="24">
...@@ -13,17 +13,11 @@ ...@@ -13,17 +13,11 @@
class="good-two" class="good-two"
@click="openGood(item)" @click="openGood(item)"
:style="{ :style="{
border: border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
background:
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2
? '#FFF'
: '',
}" }"
> >
<view class="tips" v-if="goodsInfo.showGoodsTag"> <view class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" /></view>
<image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" />
</view>
<view class="img-box"> <view class="img-box">
<view class="img-show"> <view class="img-show">
<image <image
...@@ -38,65 +32,56 @@ ...@@ -38,65 +32,56 @@
</view> </view>
</view> </view>
<view class="good-info"> <view class="good-info">
<view class="good-name" v-if="goodsInfo.showGoodsName"> <view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
{{ item.name }}
</view>
<view class="good-price-info"> <view class="good-price-info">
<view class="price" :style="{'color':mainColor}">{{ <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
goodsInfo.showGoodsPrice ? getPrice(item.price) : "" <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
}}</view> <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
<view class="buy" v-if="goodsInfo.showBuyBtn"> <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
<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 <u-button
type="primary" type="primary"
size="mini" size="mini"
:ripple="true" :ripple="true"
:color="goodsInfo.buttonColor" :color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${ :custom-style="
goodsInfo.buttonColor `backgroundColor:${goodsInfo.buttonColor},color:${
},color:${ goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'
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'
" "
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
v-else v-else
>{{ goodsInfo.buyBtnText }}</u-button
> >
{{ goodsInfo.buyBtnText }}
</u-button>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</u-col> </u-col>
</u-row> </u-row>
<good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</view> </view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
props: ["goodList", "goodsInfo"], components: {
goodSku,
auth
},
props: ['goodList', 'goodsInfo'],
data() { data() {
return { return {
mainColor: "", mainColor: '',
activeKey: 0, activeKey: 0,
showSku: false,
sku: {},
showAuth: false,
u: {}
}; };
}, },
created() { created() {
...@@ -104,9 +89,30 @@ export default { ...@@ -104,9 +89,30 @@ export default {
}, },
methods: { methods: {
openGood(item) { openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
},
showSkuHandler(g) {
this.sku = g;
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
}
}, },
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
}, },
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </script>
...@@ -166,7 +172,7 @@ export default { ...@@ -166,7 +172,7 @@ export default {
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
margin: 3px 0; margin: 3px 0;
font-size: 13px; font-size: 13px;
min-height:35px; min-height: 35px;
} }
.good-two .good-info .good-price-info { .good-two .good-info .good-price-info {
display: flex; display: flex;
......
...@@ -4,26 +4,20 @@ ...@@ -4,26 +4,20 @@
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<u-row gutter="24"> <u-row gutter="24">
<u-col <u-col span="4" v-for="(item, gli) in goodList" :key="gli">
span="4" <div
v-for="(item, gli) in goodList" class="good-three"
:key="gli" @click="openGood(item)"
:style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
}"
> >
<div class="good-three" @click="openGood(item)" :style="{ <div class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" /></div>
border:
goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background:
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2
? '#FFF'
: '',
}">
<div class="tips" v-if="goodsInfo.showGoodsTag">
<image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" />
</div>
<div class="img-box"> <div class="img-box">
<div class="img-show"> <div class="img-show">
<image <image
...@@ -38,49 +32,28 @@ ...@@ -38,49 +32,28 @@
</div> </div>
</div> </div>
<div class="good-info"> <div class="good-info">
<div class="good-name" v-if="goodsInfo.showGoodsName"> <div class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</div>
{{ item.name }}
</div>
<div class="good-price-info"> <div class="good-price-info">
<view class="price" :style="{'color':mainColor}">{{ <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
goodsInfo.showGoodsPrice ? getPrice(item.price) : ""
}}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)"> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
name="cart-o" <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
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 <u-button
type="primary" type="primary"
size="mini" size="mini"
:ripple="true" :ripple="true"
:color="goodsInfo.buttonColor" :color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${ :custom-style="
goodsInfo.buttonColor `backgroundColor:${goodsInfo.buttonColor},color:${
},color:${ goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'
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'
" "
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
v-else v-else
>{{ goodsInfo.buyBtnText }}</u-button
> >
{{ goodsInfo.buyBtnText }}
</u-button>
</view> </view>
</div> </div>
</div> </div>
...@@ -88,22 +61,27 @@ ...@@ -88,22 +61,27 @@
</u-col> </u-col>
</u-row> </u-row>
<good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku> <good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</div> </div>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku' import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
components:{ components: {
goodSku goodSku,
auth
}, },
props: ["goodList", "goodsInfo"], props: ['goodList', 'goodsInfo'],
data() { data() {
return { return {
mainColor: "", mainColor: '',
activeKey: 0, activeKey: 0,
showSku:false, showSku: false,
sku:{} sku: {},
showAuth: false,
u: {}
}; };
}, },
created() { created() {
...@@ -111,13 +89,30 @@ export default { ...@@ -111,13 +89,30 @@ export default {
}, },
methods: { methods: {
openGood(item) { openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
}, },
showSkuHandler(g){ showSkuHandler(g) {
this.sku=g this.sku = g;
this.showSku=true this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
} }
}, },
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </script>
...@@ -177,8 +172,8 @@ export default { ...@@ -177,8 +172,8 @@ export default {
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
margin: 3px 0; margin: 3px 0;
font-size: 13px; font-size: 13px;
word-break:break-all; word-break: break-all;
min-height:34px; min-height: 34px;
} }
.good-three .good-info .good-price-info { .good-three .good-info .good-price-info {
display: flex; display: flex;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<view <view
...@@ -14,85 +14,58 @@ ...@@ -14,85 +14,58 @@
@click="openGood(item)" @click="openGood(item)"
:style="{ :style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background: background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : '',
}" }"
> >
<view class="tips" v-if="goodsInfo.showGoodsTag"> <view class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width: 100%;" /></view>
<image <view class="img-box"><image style="width: 100%; height: 100%;" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.picUrl" /></view>
: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-info">
<view class="good-name" v-if="goodsInfo.showGoodsName">{{ <view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
item.name
}}</view>
<view class="good-price-info"> <view class="good-price-info">
<view class="price" :style="{'color':mainColor}">{{ <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
goodsInfo.showGoodsPrice ? getPrice(item.price) : ""
}}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)"> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
name="cart-o" <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
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 <u-button
type="primary" type="primary"
size="mini" size="mini"
:ripple="true" :ripple="true"
:color="goodsInfo.buttonColor" :color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${goodsInfo.buttonColor},color:${ :custom-style="
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 `backgroundColor:${goodsInfo.buttonColor},color:${goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'}`
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
" "
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
v-else v-else
>{{ goodsInfo.buyBtnText }}</u-button
> >
{{ goodsInfo.buyBtnText }}
</u-button>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku> <good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</view> </view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku' import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
components:{ components: {
goodSku goodSku,
auth
}, },
props: ["goodList", "goodsInfo"], props: ['goodList', 'goodsInfo'],
data() { data() {
return { return {
mainColor: "", mainColor: '',
activeKey: 0, activeKey: 0,
showSku:false, showSku: false,
sku:{} sku: {},
showAuth: false,
u: {}
}; };
}, },
created() { created() {
...@@ -100,12 +73,29 @@ export default { ...@@ -100,12 +73,29 @@ export default {
}, },
methods: { methods: {
openGood(item) { openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
}, },
showSkuHandler(g){ showSkuHandler(g) {
this.sku=g this.sku = g;
this.showSku=true this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
}
},
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
}, },
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
//格式化价格添加.00 //格式化价格添加.00
// getPrice(value){ // getPrice(value){
// var html,_val; // var html,_val;
...@@ -119,7 +109,7 @@ export default { ...@@ -119,7 +109,7 @@ export default {
// _val = value.split('.'); // _val = value.split('.');
// return html = '¥'+_val[0]+'.'+_val[1]; // return html = '¥'+_val[0]+'.'+_val[1];
// } // }
}, }
}; };
</script> </script>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<view <view
...@@ -13,87 +13,62 @@ ...@@ -13,87 +13,62 @@
v-for="(item, gli) in goodList" v-for="(item, gli) in goodList"
:key="gli" :key="gli"
:style="{ :style="{
'border': goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background: background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2
? '#FFF'
: '',
}" }"
> >
<view class="tips" v-if="goodsInfo.showGoodsTag"> <view class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" /></view>
<image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" />
</view>
<view class="img-box"> <view class="img-box">
<view class="img-show"> <view class="img-show">
<image <image style="width: 100%; height: 100%; border-radius: 10rpx 10rpx 0 0;" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.picUrl" />
style="width: 100%; height: 100%; border-radius: 10rpx 10rpx 0 0;"
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
:src="item.picUrl"
/>
</view>
</view> </view>
<view
class="good-info"
>
<view class="good-name" v-if="goodsInfo.showGoodsName">
{{ item.name }}
</view> </view>
<view class="good-info">
<view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
<view class="good-price-info"> <view class="good-price-info">
<view class="price" :style="{'color':mainColor}">{{ <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
goodsInfo.showGoodsPrice ? getPrice(item.price) : ""
}}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)"> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
name="cart-o" <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
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 <u-button
type="primary" type="primary"
size="mini" size="mini"
:ripple="true" :ripple="true"
:color="goodsInfo.buttonColor" :color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${goodsInfo.buttonColor},color:${ :custom-style="
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 `backgroundColor:${goodsInfo.buttonColor},color:${goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'}`
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
" "
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
v-else v-else
>{{ goodsInfo.buyBtnText }}</u-button
> >
{{ goodsInfo.buyBtnText }}
</u-button>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku> <good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</view> </view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku' import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
components:{ components: {
goodSku goodSku,
auth
}, },
props: ["goodList", "goodsInfo"], props: ['goodList', 'goodsInfo'],
data() { data() {
return { return {
mainColor: "", mainColor: '',
activeKey: 0, activeKey: 0,
showSku:false, showSku: false,
sku:{} sku: {},
showAuth: false,
u: {}
}; };
}, },
created() { created() {
...@@ -101,13 +76,30 @@ export default { ...@@ -101,13 +76,30 @@ export default {
}, },
methods: { methods: {
openGood(item) { openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
}, },
showSkuHandler(g){ showSkuHandler(g) {
this.sku=g this.sku = g;
this.showSku=true this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
}
}, },
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
}, },
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </script>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<view <view
...@@ -14,78 +14,58 @@ ...@@ -14,78 +14,58 @@
@click="openGood(item)" @click="openGood(item)"
:style="{ :style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background: background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : '',
}" }"
> >
<view class="tips" v-if="goodsInfo.showGoodsTag"> <view class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width: 100%;" /></view>
<image <view class="img-box"><image style="width: 100%; height: 100%;" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.picUrl" /></view>
: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-info">
<view class="good-name" v-if="goodsInfo.showGoodsName">{{ <view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
item.name
}}</view>
<view class="good-price-info"> <view class="good-price-info">
<view class="price" :style="{'color':mainColor}">{{ <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
goodsInfo.showGoodsPrice ? getPrice(item.price) : "" <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
}}</view> <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
<view class="buy" v-if="goodsInfo.showBuyBtn"> <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
<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 <u-button
type="primary" type="primary"
size="mini" size="mini"
:ripple="true" :ripple="true"
:color="goodsInfo.buttonColor" :color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${goodsInfo.buttonColor},color:${ :custom-style="
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 `backgroundColor:${goodsInfo.buttonColor},color:${goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'}`
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
" "
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
v-else v-else
>{{ goodsInfo.buyBtnText }}</u-button
> >
{{ goodsInfo.buyBtnText }}
</u-button>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</view> </view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
props: ["goodList", "goodsInfo"], components: {
goodSku,
auth
},
props: ['goodList', 'goodsInfo'],
data() { data() {
return { return {
mainColor: "", mainColor: '',
activeKey: 0, activeKey: 0,
showSku: false,
sku: {},
showAuth: false,
u: {}
}; };
}, },
created() { created() {
...@@ -93,9 +73,30 @@ export default { ...@@ -93,9 +73,30 @@ export default {
}, },
methods: { methods: {
openGood(item) { openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
},
showSkuHandler(g) {
this.sku = g;
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
}
}, },
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
}, },
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </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