|
|
@@ -9,7 +9,20 @@
|
|
|
<!-- 猜你喜欢 -->
|
|
|
<!-- <guess-like @Addcar='Addcar' @clickNavTo='navToDetailPage' :goodList = 'good_list||[]'></guess-like> -->
|
|
|
<!-- 评价 -->
|
|
|
- <estimate @navTo="navTo('/pages/product/reply?id=' + goodsid)" v-if="reply" :reply="reply" :list="list"></estimate>
|
|
|
+ <!-- <estimate @navTo="navTo('/pages/product/reply?id=' + goodsid)" v-if="reply" :reply="reply" :list="list"></estimate> -->
|
|
|
+ <!-- 积分 -->
|
|
|
+ <view class="integral">
|
|
|
+ 积分<text>最高可用购物积分抵扣20元</text>
|
|
|
+ </view>
|
|
|
+ <!-- 选择数量 -->
|
|
|
+ <view class="num">
|
|
|
+ <view class="">
|
|
|
+ 选择<text>请选择数量</text>
|
|
|
+ </view>
|
|
|
+ <view class="num-right">
|
|
|
+ <image src="../../static/img/img39.png" mode=""></image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<!-- 规格信息 -->
|
|
|
<fresh-detail :goodsObjact="goodsObjact"></fresh-detail>
|
|
|
<!-- 图文详情 -->
|
|
|
@@ -23,19 +36,23 @@
|
|
|
<!-- 遮罩层 -->
|
|
|
<view class="mask"></view>
|
|
|
<view class="layer attr-content" @click.stop="stopPrevent">
|
|
|
+ <view class="x" @click="toggleSpec">
|
|
|
+ <image src="../../static/img/x.png" mode=""></image>
|
|
|
+ </view>
|
|
|
<view class="a-t">
|
|
|
<image :src="actionImage"></image>
|
|
|
<view class="right">
|
|
|
<text class="name">{{ goodsObjact.store_name }}</text>
|
|
|
- <text class="price">¥{{ actionPrice * goodsNumber }}</text>
|
|
|
- <text class="stock">库存:{{ goodsStore }}件</text>
|
|
|
+ <text class="price"><text>¥</text>{{ actionPrice * goodsNumber }}</text>
|
|
|
+ <!-- <text class="stock">库存:{{ goodsStore }}件</text> -->
|
|
|
<view class="selected" v-if="specList != ''">
|
|
|
已选:
|
|
|
<text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">{{ sItem }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view v-for="(item, index) in specList" :key="index" class="attr-list">
|
|
|
+ <!-- 规格 -->
|
|
|
+ <!-- <view v-for="(item, index) in specList" :key="index" class="attr-list">
|
|
|
<text>{{ item.attr_name }}</text>
|
|
|
<view class="item-list">
|
|
|
<text
|
|
|
@@ -48,15 +65,39 @@
|
|
|
{{ childItem.attr }}
|
|
|
</text>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <!-- <view class="attr-list">
|
|
|
- <text>购买数量</text>
|
|
|
+ </view> -->
|
|
|
+ <view class="attr-list">
|
|
|
+ <view class="">
|
|
|
+ <text>购买数量</text>
|
|
|
+ </view>
|
|
|
<view class="item-list">
|
|
|
- <uni-number-box class="step" :isMin="true" :value="goodsNumber" :min="1" :max="goodsNumberMax" @eventChange="numberChange"></uni-number-box>
|
|
|
+ <view class="da" @click="delNum">
|
|
|
+ -
|
|
|
+ </view>
|
|
|
+ <view class="item-num">
|
|
|
+ <input type="text" v-model="goodsNumber" />
|
|
|
+ </view>
|
|
|
+ <view class="da" @click="addNum">
|
|
|
+ +
|
|
|
+ </view>
|
|
|
+ <!-- <uni-number-box class="step" :isMin="true" :value="goodsNumber" :min="1" :max="goodsNumberMax" @eventChange="numberChange"></uni-number-box> -->
|
|
|
</view>
|
|
|
- </view> -->
|
|
|
- <button class="btn" @click.stop="buy" v-show="buys_show">完成</button>
|
|
|
- <button class="btn" style="background-color: #999999;" v-show="buys_shows">售罄</button>
|
|
|
+ </view>
|
|
|
+ <view class="footer" v-show="buys_show">
|
|
|
+ <view class="" @click.stop="buy(2)">
|
|
|
+ 加入购物车
|
|
|
+ </view>
|
|
|
+ <view class="" @click.stop="buy(1)">
|
|
|
+ 立即购买
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="footer" v-show="buys_shows">
|
|
|
+ <view :class="{sq: buys_show}"style="background-color: #999999;">
|
|
|
+ 售罄
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- <button class="btn" @click.stop="buy" v-show="buys_show">完成</button>
|
|
|
+ <button class="btn" style="background-color: #999999;" v-show="buys_shows">售罄</button> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -162,6 +203,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async onLoad(options) {
|
|
|
+ console.log(this.$data);
|
|
|
let obj = this;
|
|
|
obj.userInfo = uni.getStorageSync('userInfo');
|
|
|
//保存商品id
|
|
|
@@ -187,34 +229,49 @@ export default {
|
|
|
...mapState(['weichatObj', 'baseURL', 'urlFile'])
|
|
|
},
|
|
|
// 分享
|
|
|
- onShareAppMessage(options) {
|
|
|
- // 设置菜单中的转发按钮触发转发事件时的转发内容
|
|
|
- let pages = getCurrentPages(); //获取加载的页面
|
|
|
- let currentPage = pages[pages.length - 1]; //获取当前页面的对象
|
|
|
- let url = currentPage.route; //当前页面url
|
|
|
- let item = currentPage.options; //如果要获取url中所带的参数可以查看options
|
|
|
- let shareObj = {
|
|
|
- title: this.goodsObjact.store_name + ' 价格:' + this.goodsObjact.price, // 默认是小程序的名称(可以写slogan等)
|
|
|
- path: url + '?id=' + item.id + '&spread=' + this.userInfo.uid, // 默认是当前页面,必须是以‘/’开头的完整路径
|
|
|
- imageUrl: this.goodsObjact.image,
|
|
|
- success: function(res) {
|
|
|
- // 转发成功之后的回调
|
|
|
- if (res.errMsg == 'shareAppMessage:ok') {
|
|
|
- }
|
|
|
- },
|
|
|
- fail: function() {
|
|
|
- // 转发失败之后的回调
|
|
|
- if (res.errMsg == 'shareAppMessage:fail cancel') {
|
|
|
- // 用户取消转发
|
|
|
- } else if (res.errMsg == 'shareAppMessage:fail') {
|
|
|
- // 转发失败,其中 detail message 为详细失败信息
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- return shareObj;
|
|
|
- },
|
|
|
+ // onShareAppMessage(options) {
|
|
|
+ // // 设置菜单中的转发按钮触发转发事件时的转发内容
|
|
|
+ // let pages = getCurrentPages(); //获取加载的页面
|
|
|
+ // let currentPage = pages[pages.length - 1]; //获取当前页面的对象
|
|
|
+ // let url = currentPage.route; //当前页面url
|
|
|
+ // let item = currentPage.options; //如果要获取url中所带的参数可以查看options
|
|
|
+ // let shareObj = {
|
|
|
+ // title: this.goodsObjact.store_name + ' 价格:' + this.goodsObjact.price, // 默认是小程序的名称(可以写slogan等)
|
|
|
+ // path: url + '?id=' + item.id + '&spread=' + this.userInfo.uid, // 默认是当前页面,必须是以‘/’开头的完整路径
|
|
|
+ // imageUrl: this.goodsObjact.image,
|
|
|
+ // success: function(res) {
|
|
|
+ // // 转发成功之后的回调
|
|
|
+ // if (res.errMsg == 'shareAppMessage:ok') {
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // fail: function() {
|
|
|
+ // // 转发失败之后的回调
|
|
|
+ // if (res.errMsg == 'shareAppMessage:fail cancel') {
|
|
|
+ // // 用户取消转发
|
|
|
+ // } else if (res.errMsg == 'shareAppMessage:fail') {
|
|
|
+ // // 转发失败,其中 detail message 为详细失败信息
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // return shareObj;
|
|
|
+ // },
|
|
|
methods: {
|
|
|
+ delNum() {
|
|
|
+ this.goodsNumber < 2 || this.goodsNumber--
|
|
|
+ },
|
|
|
+ addNum() {
|
|
|
+ if(this.goodsNumberMax > this.goodsNumber ) {
|
|
|
+ this.goodsNumber++
|
|
|
+ }else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '超出最大购买数',
|
|
|
+ type: 'top',
|
|
|
+ duration: 2000,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
//选择规格
|
|
|
selectSpec(item, arr, ind) {
|
|
|
arr.attr_value.forEach(function(e) {
|
|
|
@@ -242,10 +299,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 打開彈窗
|
|
|
- specOPne(type=1) {
|
|
|
+ specOPne() {
|
|
|
let obj = this;
|
|
|
obj.specClass = 'show';
|
|
|
- obj.type = type
|
|
|
},
|
|
|
//规格弹窗开关
|
|
|
toggleSpec(str) {
|
|
|
@@ -348,7 +404,8 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 立即购买
|
|
|
- buy() {
|
|
|
+ buy(type) {
|
|
|
+ this.type = type
|
|
|
let obj = this;
|
|
|
// 创建传值对象
|
|
|
let data = {
|
|
|
@@ -391,7 +448,39 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss">
|
|
|
+<style lang="scss" scoped>
|
|
|
+ //积分
|
|
|
+ .integral {
|
|
|
+ background-color: #fff;
|
|
|
+ margin-top: 20rpx;
|
|
|
+ padding: 30rpx;
|
|
|
+ color: #666666;
|
|
|
+ font-size: 28rpx;
|
|
|
+ text {
|
|
|
+ margin-left: 40rpx;
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //选择数量
|
|
|
+ .num {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ background-color: #fff;
|
|
|
+ margin-top: 20rpx;
|
|
|
+ padding: 30rpx;
|
|
|
+ color: #666666;
|
|
|
+ font-size: 28rpx;
|
|
|
+ text {
|
|
|
+ margin-left: 40rpx;
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+ .num-right {
|
|
|
+ image {
|
|
|
+ width: 25rpx;
|
|
|
+ height: 25rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
/* 弹出层 */
|
|
|
.popup {
|
|
|
position: fixed;
|
|
|
@@ -440,7 +529,7 @@ export default {
|
|
|
z-index: 99;
|
|
|
bottom: 0;
|
|
|
width: 100%;
|
|
|
- min-height: 35vh;
|
|
|
+ min-height: 650rpx;
|
|
|
border-radius: 10rpx 10rpx 0 0;
|
|
|
background-color: #fff;
|
|
|
|
|
|
@@ -498,10 +587,21 @@ export default {
|
|
|
/* 规格选择弹窗 */
|
|
|
.attr-content {
|
|
|
padding: 25rpx 30rpx;
|
|
|
+
|
|
|
+ .x {
|
|
|
+ position: absolute;
|
|
|
+ top: 30rpx;
|
|
|
+ right: 30rpx;
|
|
|
+ image {
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
.a-t {
|
|
|
display: flex;
|
|
|
-
|
|
|
+ padding: 80rpx 0;
|
|
|
+ border-bottom: solid 1rpx #EEEEEE;
|
|
|
image {
|
|
|
width: 170rpx;
|
|
|
height: 170rpx;
|
|
|
@@ -519,9 +619,13 @@ export default {
|
|
|
width: 75%;
|
|
|
|
|
|
.price {
|
|
|
- font-size: $font-lg;
|
|
|
- color: $uni-color-primary;
|
|
|
+ font-size: 50rpx;
|
|
|
+ color: #EF3A55;
|
|
|
margin: 10rpx 0rpx;
|
|
|
+ text {
|
|
|
+ font-size: 30rpx;
|
|
|
+ margin-right: 10rpx;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.name {
|
|
|
@@ -541,39 +645,62 @@ export default {
|
|
|
}
|
|
|
|
|
|
.attr-list {
|
|
|
+ width: 100%;
|
|
|
display: flex;
|
|
|
- flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
font-size: $font-base + 2rpx;
|
|
|
color: $font-color-base;
|
|
|
- padding-top: 30rpx;
|
|
|
+ padding-top: 80rpx;
|
|
|
padding-left: 10rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .item-list {
|
|
|
- padding: 20rpx 0 0;
|
|
|
- display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
-
|
|
|
- text {
|
|
|
+ // padding: 40rpx;
|
|
|
+ .item-list {
|
|
|
+ text-align: center;
|
|
|
display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- background: #eee;
|
|
|
- margin-right: 20rpx;
|
|
|
- margin-bottom: 20rpx;
|
|
|
- border-radius: 100rpx;
|
|
|
- min-width: 60rpx;
|
|
|
- height: 60rpx;
|
|
|
- padding: 0 20rpx;
|
|
|
- font-size: $font-base;
|
|
|
- color: $font-color-dark;
|
|
|
- }
|
|
|
-
|
|
|
- .selected {
|
|
|
- background: #ddffdf;
|
|
|
- color: $uni-color-primary;
|
|
|
+ height: 60rpx;
|
|
|
+ .item-num {
|
|
|
+ width: 100rpx;
|
|
|
+ border: solid 1rpx #CFCFCF;
|
|
|
+ }
|
|
|
+ .da {
|
|
|
+ line-height: 60rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ width: 60rpx;
|
|
|
+ border: solid 1rpx #CFCFCF;
|
|
|
+ margin: auto 0;
|
|
|
+ background-color: #F6F6F6 ;
|
|
|
+ }
|
|
|
+ input {
|
|
|
+ width: 100rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // .item-list {
|
|
|
+ // padding: 20rpx 0 0;
|
|
|
+ // display: flex;
|
|
|
+ // flex-wrap: wrap;
|
|
|
+
|
|
|
+ // text {
|
|
|
+ // display: flex;
|
|
|
+ // align-items: center;
|
|
|
+ // justify-content: center;
|
|
|
+ // background: #eee;
|
|
|
+ // margin-right: 20rpx;
|
|
|
+ // margin-bottom: 20rpx;
|
|
|
+ // border-radius: 100rpx;
|
|
|
+ // min-width: 60rpx;
|
|
|
+ // height: 60rpx;
|
|
|
+ // padding: 0 20rpx;
|
|
|
+ // font-size: $font-base;
|
|
|
+ // color: $font-color-dark;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // .selected {
|
|
|
+ // background: #ddffdf;
|
|
|
+ // color: $uni-color-primary;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
//默认商品底部高度
|
|
|
@@ -610,4 +737,27 @@ page {
|
|
|
width: 100% !important;
|
|
|
height: auto;
|
|
|
}
|
|
|
+.footer {
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ display: flex;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ height: 100rpx;
|
|
|
+ line-height: 100rpx;
|
|
|
+ margin-left: -30rpx;
|
|
|
+ view {
|
|
|
+ width: 50%;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ view:nth-child(1) {
|
|
|
+ background-color: #FFB238;
|
|
|
+ }
|
|
|
+ view:nth-child(2) {
|
|
|
+ background-color: #438BED;
|
|
|
+ }
|
|
|
+ .sq {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|