670 lines
13 KiB
Vue
670 lines
13 KiB
Vue
<template>
|
||
<view style="padding-bottom: 300rpx;">
|
||
<view class="" style="display: flex; flex-direction: column;">
|
||
<view style="position: relative;">
|
||
<view class="title" :style="{marginTop: statusBarHeight + 'rpx' }">
|
||
商城好物
|
||
</view>
|
||
<image v-if="advert!=null&&advert.length>0" :src="advert[0].imgurl" style="width: 100%; margin-top: ;"
|
||
mode=""></image>
|
||
<!-- <view style="background-image: url('https://xinglanmh.shequtuangou.vip/static/image/20240711134727.png');background-size: 100% 100%;height:600rpx;">
|
||
<view style="height:200rpx;"></view>
|
||
<view style="width:90%;height:286rpx;margin-left: 5%;">
|
||
<swiper class="swiper-box" :autoplay="true" :indicator-dots="false" :circular="true" :interval="3000">
|
||
<swiper-item v-for="(v, i) in advert" :key="i" @click="$c.navTo(v)">
|
||
<image class="yh_bg" :src="v.imgurl" style="width: 100%;height: 100%;"></image>
|
||
</swiper-item>
|
||
</swiper>
|
||
</view>
|
||
</view> -->
|
||
|
||
|
||
</view>
|
||
|
||
<view class="grid-container">
|
||
<view v-for="(item,index) in datas" :key="index" class="grid-item" @click="order_money(item)">
|
||
<image src="https://bajiapi.onelight.vip/static/web/static/common/20240711134549.png"
|
||
style="height: 430rpx; position: absolute;" mode="heightFix"></image>
|
||
|
||
<image :src="item.imgurl"
|
||
style=" width: 326.39rpx; height: 326.39rpx; position: absolute; left: 2rpx;" mode=""></image>
|
||
|
||
<view class="goods-name">
|
||
<text style="color: #FFF8F8FA; font-size: 27rpx;">{{item.title}}</text>
|
||
</view>
|
||
|
||
<view class="price-box">
|
||
<view class="price">
|
||
<text>¥{{item.price}}</text>
|
||
</view>
|
||
</view>
|
||
<view class="num-box">
|
||
<view class="box icon">
|
||
<image :src="$img1('index/box.png')" lazy-load></image>
|
||
</view>
|
||
<view class="num ml10"> {{ item.sale_stock }}/{{ item.stock }} </view>
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
|
||
</view>
|
||
<uni-popup ref="pop" type="bottom">
|
||
<view v-if="orderData" class="buy-pop relative">
|
||
<view class="buy-pop-hd">
|
||
<text class="ziti">确认订单</text>
|
||
<view class="close icon" @click="close('pop')">
|
||
<image :src="$img('/static/img/close2.png')" lazy-load></image>
|
||
</view>
|
||
</view>
|
||
<view class="buy-card">
|
||
<view class="buy-info">
|
||
<view class="pic">
|
||
<image :src="orderData.goods.imgurl_detail" style="width: 190rpx; height: 190rpx;"
|
||
lazy-load>
|
||
</image>
|
||
</view>
|
||
<view class="info-r">
|
||
<view class="hang1" style="width: 100%; color: white;">
|
||
{{ orderData.goods.title }}
|
||
</view>
|
||
<view class="type">类型:明信片</view>
|
||
|
||
<view class="price-num">
|
||
<view class="price">
|
||
¥<text>{{ orderData.goods.price }}</text>
|
||
</view>
|
||
<view class="num">×{{ orderData.goods.prize_num }}</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
<view class="pay-title ziti">选择支付方式</view>
|
||
<view class="br20 mt20" style="background: #5B5B5D;">
|
||
<view class="pay-type" @click="changePay('isWXPay')">
|
||
<view class="" style="width: 100%; color: white;">
|
||
微信支付
|
||
</view>
|
||
<view class="icon">
|
||
<image v-if="isWXPay" :src="$img1('common/check_act.png')" lazy-load></image>
|
||
|
||
<image v-else :src="$img1('common/check.png')" lazy-load></image>
|
||
</view>
|
||
</view>
|
||
<view class="pay-type" @click="changePay('useMoney')">
|
||
|
||
<view class="" style="width: 100%; color: white;">
|
||
星钻支付¥
|
||
{{ orderData.goods.price }} (剩余:{{ orderData.money }})
|
||
</view>
|
||
|
||
<view class="icon">
|
||
<image v-if="useMoney" :src="$img1('common/check_act.png')" lazy-load></image>
|
||
|
||
<image v-else :src="$img1('common/check.png')" lazy-load></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="rule">
|
||
<scroll-view class="rule-inner" scroll-y>
|
||
<view v-html="sendRuleData"></view>
|
||
</scroll-view>
|
||
</view>
|
||
<view class="agree" @click="isAgree = !isAgree">
|
||
<view class="icon">
|
||
<image v-if="isAgree" :src="$img1('common/check_act.png')" lazy-load></image>
|
||
|
||
<image v-else :src="$img1('common/check.png')" lazy-load></image>
|
||
</view>
|
||
|
||
我已满18岁,阅读并同意
|
||
|
||
<text @click.stop="$c.to({ url: '/pages/guize/guize?type=4' })">
|
||
《用户协议》
|
||
</text>
|
||
|
||
<text @click.stop="$c.to({ url: '/pages/guize/guize?type=5' })">
|
||
《隐私政策》
|
||
</text>
|
||
</view>
|
||
|
||
|
||
|
||
<view class="pay-btn" @click="$c.noDouble(confirmSubmit(1))">
|
||
<text>立即支付</text>
|
||
<text>
|
||
{{
|
||
` ¥${orderData.price}`
|
||
}}
|
||
</text>
|
||
</view>
|
||
</view>
|
||
</uni-popup>
|
||
</view>
|
||
|
||
|
||
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
|
||
data() {
|
||
return {
|
||
statusBarHeight: 0,
|
||
datas: [],
|
||
advert: [],
|
||
sendRuleData: '',
|
||
goodsId: "",
|
||
orderData: null,
|
||
isAgree: true,
|
||
isWXPay: true,
|
||
useMoney: true,
|
||
|
||
}
|
||
},
|
||
onLoad() {
|
||
// 获取系统信息
|
||
uni.getSystemInfo({
|
||
success: (res) => {
|
||
// 状态栏的高度
|
||
this.statusBarHeight = res.statusBarHeight + 20;
|
||
}
|
||
});
|
||
|
||
this.getData();
|
||
this.load();
|
||
this.$c.getRule(10).then(res => {
|
||
if (res.status == 1) {
|
||
this.sendRuleData = res.data
|
||
}
|
||
});
|
||
},
|
||
onShow() {
|
||
|
||
const curPages = getCurrentPages()[0]; // 获取当前页面实例
|
||
if (typeof curPages.getTabBar === 'function' && curPages.getTabBar()) {
|
||
this.$mp.page.getTabBar().setData({
|
||
selected: 2
|
||
});
|
||
}
|
||
},
|
||
methods: {
|
||
load() {
|
||
let that = this
|
||
that.req({
|
||
url: 'getAdvert?type_id=3',
|
||
success(res) {
|
||
if (res.status == 1) {
|
||
that.advert = res.data
|
||
}
|
||
}
|
||
})
|
||
|
||
},
|
||
getStatusBarHeight() {
|
||
const systemInfo = uni.getSystemInfoSync();
|
||
this.statusBarHeight = systemInfo.statusBarHeight;
|
||
console.log('statusBarHeight', this.statusBarHeight);
|
||
},
|
||
|
||
getData() {
|
||
let that = this
|
||
that.req({
|
||
url: 'goods',
|
||
data: {
|
||
type: '10',
|
||
page: 1,
|
||
use_money_is: this.useMoney ? 1 : 2,
|
||
use_integral_is: this.isWXPay ? 1 : 2,
|
||
},
|
||
success(res) {
|
||
that.datas = res.data.data
|
||
}
|
||
});
|
||
},
|
||
|
||
|
||
order_money(data) {
|
||
console.log(234);
|
||
this.goodsId = data.id;
|
||
var that = this;
|
||
this.req({
|
||
url: 'ordermoney',
|
||
data: {
|
||
prize_num: 1,
|
||
goods_id: data.id,
|
||
goods_num: 1,
|
||
use_money_is: this.useMoney ? 1 : 2,
|
||
use_integral_is: this.isWXPay ? 1 : 2,
|
||
// coupon_id: (that.couponData && that.couponData.id) || ''
|
||
},
|
||
success(res) {
|
||
if (res.status == 1) {
|
||
// that.pay_news = res.data
|
||
// if (res.data.coupon_id) {
|
||
// that.couponData = {
|
||
// id: res.data.coupon_id,
|
||
// price: res.data.coupon_price
|
||
// }
|
||
// }
|
||
that.orderData = res.data
|
||
that.$refs.pop.open()
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
close(e) {
|
||
this.$refs[e].close()
|
||
},
|
||
|
||
changePay(e) {
|
||
this[e] = !this[e]
|
||
|
||
this.confirmSubmit(0)
|
||
},
|
||
|
||
confirmSubmit(type) {
|
||
|
||
if (!this.useMoney && !this.isWXPay) {
|
||
uni.showToast({
|
||
title: '请选择支付方式',
|
||
icon: 'none',
|
||
});
|
||
return;
|
||
}
|
||
|
||
console.log("type", type);
|
||
|
||
var that = this;
|
||
|
||
let url = 'infinite_ordermoney'
|
||
|
||
let data = {
|
||
goods_id: this.goodsId,
|
||
prize_num: 1,
|
||
use_money_is: this.useMoney ? 1 : 2,
|
||
use_integral_is: this.isWXPay ? 1 : 2,
|
||
// coupon_id: (this.couponData && this.couponData.id) || '',
|
||
// is_mibao: this.pageTabCur
|
||
// ad_id: uni.getStorageSync('_ad_id')
|
||
}
|
||
|
||
if (type == 1) {
|
||
url = 'infinite_orderbuy'
|
||
|
||
// if (this.pageTabCur == 1) {
|
||
// url = 'infinite_mibao_orderbuy'
|
||
// data = {
|
||
// goods_id: this.pageData.goods.id,
|
||
// prize_num: this.buyNum,
|
||
// // is_mibao: this.pageTabCur
|
||
// }
|
||
// }
|
||
|
||
// if (!uni.getStorageSync('_agree_buy_notice') && !fromNotice) {
|
||
// this.$refs.buyNotice.getRule(6)
|
||
// return
|
||
// }
|
||
}
|
||
|
||
|
||
this.req({
|
||
url,
|
||
data,
|
||
success: async res => {
|
||
if (res.status == 1) {
|
||
if (type == 0) {
|
||
console.log("res.data", res.data);
|
||
this.orderData = res.data;
|
||
|
||
// that.open('pop');
|
||
}
|
||
|
||
if (type == 1) {
|
||
that.close('pop')
|
||
if (res.data.status == 1) {
|
||
|
||
const status = await that.$c.wxMpPay({
|
||
data: res.data.res
|
||
})
|
||
if (status == 'success') {
|
||
// that.getPrize(res.data.order_num)
|
||
that.getData();
|
||
}
|
||
|
||
|
||
|
||
|
||
} else {
|
||
that.$c.toast({
|
||
title: res.msg,
|
||
duration: 500,
|
||
success: () => {
|
||
// that.getPrize(res.data.order_num)
|
||
that.getData();
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
}
|
||
})
|
||
|
||
},
|
||
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.title {
|
||
width: 100%;
|
||
position: absolute;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: white;
|
||
z-index: 100;
|
||
}
|
||
|
||
.grid-container {
|
||
display: grid;
|
||
margin: 33rpx;
|
||
padding-bottom: 200rpx;
|
||
grid-template-columns: repeat(2, 1fr);
|
||
gap: 16px;
|
||
}
|
||
|
||
.grid-item {
|
||
height: 430rpx;
|
||
position: relative;
|
||
}
|
||
|
||
.goods-name {
|
||
position: absolute;
|
||
left: 25rpx;
|
||
bottom: 60rpx;
|
||
}
|
||
|
||
.price-box {
|
||
display: flex;
|
||
position: absolute;
|
||
left: 18rpx;
|
||
bottom: 10rpx;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
|
||
.price {
|
||
font-weight: 500;
|
||
font-size: 24rpx;
|
||
color: #F8D300;
|
||
|
||
text {
|
||
font-size: 36rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.num-box {
|
||
display: flex;
|
||
align-items: center;
|
||
position: absolute;
|
||
bottom: 20rpx;
|
||
right: 20rpx;
|
||
|
||
.num {
|
||
font-size: 24rpx;
|
||
font-family: Source Han Sans CN;
|
||
font-weight: 400;
|
||
color: #cccccc;
|
||
}
|
||
|
||
.box {
|
||
width: 26rpx;
|
||
height: 26rpx;
|
||
margin-left: 6rpx;
|
||
}
|
||
|
||
.icon {}
|
||
}
|
||
|
||
.buy-pop {
|
||
padding: 0 30rpx;
|
||
box-sizing: border-box;
|
||
background: #1C1B20;
|
||
padding-bottom: 200rpx;
|
||
z-index: 999;
|
||
|
||
&::after {
|
||
content: '';
|
||
position: absolute;
|
||
top: -62rpx;
|
||
left: 0;
|
||
width: 750rpx;
|
||
height: 62rpx;
|
||
background: url($imgurl+'common/ding.png') no-repeat 0 0 / 100% 100%;
|
||
}
|
||
|
||
.buy-pop-hd {
|
||
padding: 20rpx 0;
|
||
padding-left: 10rpx;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
|
||
>text {
|
||
font-size: 32rpx;
|
||
font-weight: 500;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.close {
|
||
width: 60rpx;
|
||
height: 60rpx;
|
||
}
|
||
}
|
||
|
||
.buy-card {
|
||
border-radius: 20rpx;
|
||
padding: 30rpx 30rpx 30rpx 30rpx;
|
||
background: #5B5B5D;
|
||
|
||
.buy-info {
|
||
display: flex;
|
||
|
||
.pic {
|
||
width: 190rpx;
|
||
height: 190rpx;
|
||
border-radius: 10rpx;
|
||
}
|
||
|
||
.info-r {
|
||
width: calc(100% - 190rpx);
|
||
box-sizing: border-box;
|
||
display: flex;
|
||
flex-flow: column nowrap;
|
||
justify-content: space-between;
|
||
padding: 10rpx 10rpx 10rpx 30rpx;
|
||
|
||
.title {
|
||
font-size: 32rpx;
|
||
font-family: Source Han Sans CN;
|
||
font-weight: 400;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.hang1 {}
|
||
|
||
.type {
|
||
font-size: 28rpx;
|
||
font-family: Source Han Sans CN;
|
||
font-weight: 400;
|
||
color: #dddddd;
|
||
}
|
||
|
||
.price-num {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
|
||
.price {
|
||
ffont-weight: 500;
|
||
font-size: 35rpx;
|
||
color: #F6C0FF;
|
||
}
|
||
|
||
.num {
|
||
font-size: 28rpx;
|
||
font-family: Source Han Sans CN;
|
||
font-weight: 400;
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.line {
|
||
height: 1px;
|
||
background: #222222;
|
||
margin: 30rpx 0 10rpx;
|
||
}
|
||
|
||
.yhfs {
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
.card-row {
|
||
padding: 16rpx 0;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
|
||
.title {
|
||
>image {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
}
|
||
|
||
>text {
|
||
font-weight: 400;
|
||
font-size: 24rpx;
|
||
color: #FFFFFF;
|
||
}
|
||
}
|
||
|
||
.row-r {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
font-size: 24rpx;
|
||
font-family: Source Han Sans CN;
|
||
font-weight: 400;
|
||
color: #FFFFFF;
|
||
|
||
.icon {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.card-row {
|
||
.title {}
|
||
|
||
.row-r {
|
||
.icon {}
|
||
}
|
||
}
|
||
}
|
||
|
||
.pay-title {
|
||
margin-top: 30rpx;
|
||
font-size: 38rpx;
|
||
font-weight: 400;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.pay-type {
|
||
padding: 30rpx;
|
||
border-radius: 20rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
flex-direction: row;
|
||
|
||
.icon {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
}
|
||
|
||
.title {
|
||
flex: 1;
|
||
padding: 0 20rpx;
|
||
font-size: 28rpx;
|
||
font-family: Source Han Sans CN;
|
||
font-weight: 400;
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
|
||
.agree {
|
||
display: flex;
|
||
margin-top: 30rpx;
|
||
|
||
font-size: 24rpx;
|
||
font-family: Source Han Sans CN;
|
||
font-weight: 400;
|
||
color: #ffffff;
|
||
line-height: 32rpx;
|
||
|
||
.icon {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
margin-right: 10rpx;
|
||
}
|
||
}
|
||
|
||
.rule {
|
||
padding: 20rpx;
|
||
background: #5B5B5D;
|
||
border-radius: 20rpx;
|
||
box-sizing: border-box;
|
||
margin: 20rpx 0 0;
|
||
|
||
.rule-inner {
|
||
max-height: 160rpx;
|
||
|
||
font-size: 20rpx;
|
||
font-family: Source Han Sans CN;
|
||
font-weight: 400;
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
|
||
.pay-btn {
|
||
margin: 30rpx auto 0;
|
||
width: 406rpx;
|
||
height: 116rpx;
|
||
background: url($imgurl+'common/payBtn.png') no-repeat 0 0 / 100% 100%;
|
||
display: flex;
|
||
justify-content: center;
|
||
font-weight: 500;
|
||
color: #7825DE;
|
||
|
||
>text:nth-child(1) {
|
||
font-size: 28rpx;
|
||
margin-top: 32rpx;
|
||
}
|
||
|
||
>text:nth-child(2) {
|
||
font-size: 36rpx;
|
||
margin-top: 26rpx;
|
||
}
|
||
}
|
||
}
|
||
</style> |