首页,我的 写扫码点餐之前提交1.0.0

This commit is contained in:
wwz
2025-02-13 16:49:13 +08:00
parent 6cea5aeb42
commit f2513ef13a
48 changed files with 7757 additions and 514 deletions

692
pages/user/shop/confirm.vue Normal file
View File

@@ -0,0 +1,692 @@
<template>
<view class="content" :style="[theme]">
<view class="onecontent">
<view class="onecontentone flex-start">
<view class="onecontent_one">
商品信息
</view>
</view>
<view class="onecontenttow flex-start">
<view class="onecontenttowitem flex-between" v-for="(item,index) in elist.goods" :key="index">
<view class="onecontenttowitem_one flex-start">
<image class="onecontenttowitemimage" :src="item.img" mode="aspectFill"></image>
<view class="onecontenttowitem_onebox flex-colum-start">
<view class="onecontenttowitem_onebox_one">
{{item.title || '无'}}
</view>
<view class="onecontenttowitem_onebox_tow">
{{item.spec || '无'}}
</view>
</view>
</view>
<view class="onecontenttowitem_tow flex-colum-end">
<view class="onecontenttowitem_towstext_one">
{{item.price || '无'}}
</view>
<view class="onecontenttowitem_towstetx_tow">
×{{item.number || '无'}}
</view>
</view>
</view>
</view>
</view>
<view class="onecontent" style="margin-top: 32rpx;">
<view class="onecontentone flex-between">
<view class="onecontent_one">
确认地址
</view>
<u-icon name="arrow-right" color="#000" size="14"></u-icon>
</view>
<view class="onecontentaddress flex-colum-start" v-if="elist.address" @click="clickaddress">
<view class="onecontentaddressone" v-if="formlist.type == 3">
{{elist.address.address}}
</view>
<view class="onecontentaddressone" v-else>
{{elist.address.province}}-{{elist.address.city}}-{{elist.address.area}}-{{elist.address.address}}
</view>
<view class="onecontentaddresstow">
{{elist.address.name}}<text style="margin-left: 10rpx;">{{elist.address.mobile}}</text>
</view>
</view>
<view class="onecontentaddress" v-else>
<view class="onecontentaddressone" @click="clickaddress">
去添加地址
</view>
</view>
</view>
<view class="therecontent">
<!-- <view class="therecontenttow flex-between">
<view class="therecontenttow_one">
商品金额
</view>
<view class="therecontenttow_tow">
{{elist.number}}
</view>
</view>
<view class="therecontenttow flex-between">
<view class="therecontenttow_one">
优惠券
</view>
<view class="therecontenttow_tow">
暂无可用
</view>
</view> -->
<view class="therecontenttow flex-between">
<view class="therecontenttow_one">
运费
</view>
<view class="therecontenttow_tow">
{{elist.freight}}
</view>
</view>
<view class="therecontenttow flex-between">
<view class="therecontenttow_one">
合计
</view>
<view class="therecontenttow_tow" style="color:#FC5F69;">
{{elist.price.total_price}}
</view>
</view>
</view>
<!-- <view class="fivecontent">
<view class="fivecontentitem flex-between">
<view class="fivecontentitem_one">
手机号码
</view>
<view class="fivecontentitem_tow">
{{mobile}}
</view>
</view>
<view class="fivecontentitem flex-between">
<view class="fivecontentitem_one">
姓名
</view>
<view class="fivecontentitem_tow">
张雪
</view>
</view>
</view> -->
<view class="sixcontent">
<view class="sixcontentone flex-between">
<view class="sixcontent_one">
支付方式
</view>
</view>
<view class="sixcontenttow">
<view class="sixcontenttowitem flex-between" @click="clickselect(1)">
<view class="sixcontenttowitemone flex-start">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/wx.png" mode="aspectFill"></image>
<text class="sixcontenttowitemonetext">微信支付</text>
</view>
<view class="flex-start">
<u-icon v-if="pay_type == 1" name="checkmark-circle-fill" color="#333333" size="18"></u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#999999" size="18"></u-icon>
</view>
</view>
<view class="sixcontenttowitem flex-between" @click="clickselect(2)">
<view class="sixcontenttowitemone flex-start">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/ye.png" mode="aspectFill"></image>
<text class="sixcontenttowitemonetext">余额支付</text>
</view>
<view class="flex-start">
<u-icon v-if="pay_type == 2" name="checkmark-circle-fill" color="#333333" size="18"></u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#999999" size="18"></u-icon>
</view>
</view>
</view>
</view>
<!-- <view class="fourcontent">
<view class="fourcontentone flex-start">
<view class="fourcontent_one">
须知
</view>
</view>
<view class="fourcontenttow flex-colum-start">
</view>
</view> -->
<view :style="{height:height}">
</view>
<view class="fixedview flex-between">
<view class="fixedview_one flex-start">
<view class="fixedview_oneone">
实付金额
</view>
<view class="fixedview_onetow">
<text>¥</text>{{elist.price.price}}
</view>
</view>
<view class="fixedview_tow" @tap="$u.debounce(showpopupclick,1000)">
立即付款
</view>
</view>
<u-popup :show="showpopup" @close="closepopup" @open="openpopup" mode="center" :round="10">
<view class="u-popupflex-colum flex-colum">
<view class="u-popupflex-columview">
请输入支付密码
</view>
<u-code-input v-model="ucodeinputvalue" :maxlength="6" dot @finish="finish"></u-code-input>
</view>
</u-popup>
</view>
</template>
<script>
export default {
data() {
return {
showpopup: false,
ucodeinputvalue: '',
height: '',
order_id: '',
elist: {
address: {
},
price: {
total_price: '',
id: ''
}
},
mobile: uni.cache.get('loginuser').userinfo.mobile,
formlist: {
goods_id: ''
},
pay_type: 1
}
},
async onLoad(e) {
// this.elist = JSON.parse(optionItem)
this.formlist = e
this.formlist.spec = decodeURIComponent(e.spec)
let res = await this.api.shoppingindexgoodindexoforders({
type: this.formlist.type, // 1购物车 2商品详情页
goods_id: this.formlist.goods_id, //商品ID 商品详情页来源时必填
car_id: this.formlist.car_id, //购物车ID 1,2 购物车来源时必填
number: this.formlist.number, //数量 商品详情页来源时必填
spec: this.formlist.spec, //规格 商品详情页来源时必填
address_id: this.formlist.address_id, //地址ID 可以为空(为空时返回默认地址)
order_id:this.formlist.order_id,
})
if (res) {
this.elist = res
this.elist.goods[0].spec = this.formlist.spec
if (this.elist.address) {
this.elist.address.mobile = res.address.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
}
}
},
computed: {
theme() {
return this.$store.getters.theme
},
},
methods: {
clickaddress() {
uni.pro.navigateTo("user/address/index", {
order: 1
});
uni.$once('update', data => {
this.elist.address = JSON.parse(data)
if (this.elist.address) {
this.elist.address.mobile = this.elist.address.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
}
this.$forceUpdate();
})
},
openpopup() {
console.log('open');
},
closepopup() {
this.showpopup = false
},
finish(e) {
this.reservationmakenowsub()
},
showpopupclick() {
if(this.elist.address == null || this.elist.address == undefined){
uni.showToast({
icon: 'none',
title: '收货地址不能为空'
})
return false
}
if (this.pay_type == 1) {
uni.showLoading({
title: '加载中',
mask: true
})
this.reservationmakenowsub()
return false;
} else {
if (this.pay_type == 2) {
if (this.elist.is_vip_password == 0) {
uni.showModal({
title: '提示',
content: '您目前没有设置密码,请先设置支付密码',
success: function(res) {
if (res.confirm) {
uni.redirectTo({
url: '/pages/my/setup/repairpassword'
});
} else if (res.cancel) {}
}
});
} else {
this.showpopup = true
}
}
}
},
async reservationmakenowsub() {
var datareslane = await this.api.shoppingindexgoodindexsuborder({
type: this.formlist.type,
goods_id: this.formlist.goods_id, //商品ID 商品详情页来源时必填
car_id: this.formlist.car_id, //购物车ID 1,2 购物车来源时必填
number: this.formlist.number, //数量 商品详情页来源时必填
spec: this.formlist.spec, //规格 商品详情页来源时必填
address_id: this.formlist.address_id, //地址ID 可以为空(为空时返回默认地址)
pay_type: this.pay_type ,//1微信 2余额卡
order_id:this.formlist.order_id
})
console.log(datareslane, 280)
if (datareslane.data) {
let res = await this.api.shoppingindexgoodindexgetpayparams({
order_id: datareslane.data.order_id,
sec_password: this.ucodeinputvalue //安全密码 余额卡支付时有效
}) //判断是否支付成功
this.ucodeinputvalue = ''
console.log(res, 287)
if (res.data.pay_status == 0) {
this.showpopup = false
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.pay_data.payAppId, // 微信支付商户号
timeStamp: res.data.pay_data.payTimeStamp, // 时间戳(单位:秒)
nonceStr: res.data.pay_data.paynonceStr, // 随机字符串
package: res.data.pay_data.payPackage, // 固定值
signType: res.data.pay_data.paySignType, //固定值
paySign: res.data.pay_data.paySign, //签名
success: (res) => {
uni.showToast({
title: "支付成功"
})
uni.redirectTo({
url: "/pages/mall/order/ordersuccess?id=" + datareslane.data.order_id,
});
},
fail: (err) => {
setTimeout(res => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
uni.hideLoading()
}, 2000)
uni.redirectTo({
url: "/pages/mall/order/index?e=" +0,
});
}
});
// #endif
} else {
uni.redirectTo({
url: "/pages/mall/order/ordersuccess?id=" + datareslane.data.order_id,
});
}
} else {
uni.showToast({
title: res.message || res.msg,
icon: "none",
success() {
setTimeout(res => {
// if (options.toast) {
uni.hideLoading()
// }
}, 2000)
}
})
}
},
clickselect(b) {
this.pay_type = b
},
},
mounted() {
//#ifdef MP-WEIXIN || H5
var query = uni.createSelectorQuery().in(this).select('.fixedview')
query.boundingClientRect(ele => {
var that = this;
uni.getSystemInfo({
success(res) {
that.height = (ele.height) + "px";
that = null;
}
})
}).exec();
//#endif
//#ifdef MP-ALIPAY
my.createSelectorQuery().selectAll('.fixedview').boundingClientRect().exec(ele => {
var nodeData = ele[0]
var that = this;
that.height = (nodeData.height) + "px";
that = null;
})
//#endif
},
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.content {
padding: 32rpx 28rpx;
.onecontent {
width: 100%;
background: #FFFFFF;
padding: 32rpx;
border-radius: 12rpx;
.onecontentone {
padding-bottom: 28rpx;
border-bottom: 1px solid #F7F7F7;
.onecontent_one {
font-size: 28rpx;
font-weight: bold;
font-family: PingFang SC-Bold, PingFang SC;
color: #333333;
}
.onecontent_tow {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-left: 32rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
}
.onecontentaddress {
.onecontentaddressone {
margin-top: 24rpx;
font-size: 28rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
}
.onecontentaddresstow {
margin-top: 24rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #666666;
}
}
.onecontenttow {
width: 100%;
.onecontenttowitem {
margin-top: 24rpx;
width: 100%;
.onecontenttowitem_one {
.onecontenttowitemimage {
width: 124rpx;
height: 124rpx;
}
.onecontenttowitem_onebox {
margin-left: 24rpx;
.onecontenttowitem_onebox_one {
font-size: 32rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #1A1A1A;
}
.onecontenttowitem_onebox_tow {
margin-top: 32rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #666666;
}
}
}
.onecontenttowitem_tow {
.onecontenttowitem_towstext_one {
font-size: 32rpx;
font-family: Roboto-Medium, Roboto;
font-weight: 500;
color: #333333;
}
.onecontenttowitem_towstetx_tow {
margin-top: 32rpx;
font-size: 28rpx;
font-family: DIN Alternate-Bold, DIN Alternate;
font-weight: bold;
color: #666666;
}
}
}
}
}
.fivecontent {
width: 100%;
background: #FFFFFF;
padding: 32rpx;
border-radius: 12rpx;
margin-top: 32rpx;
.fivecontentitem:nth-child(2) {
border: none !important;
}
.fivecontentitem {
padding: 18rpx 0;
border-bottom: 1px solid #F7F7F7;
.fivecontentitem_one {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
.fivecontentitem_tow {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
}
}
.therecontent {
width: 100%;
background: #FFFFFF;
padding: 32rpx;
border-radius: 12rpx;
margin-top: 32rpx;
.therecontenttow:nth-child(1) {
margin-top: 0 !important;
}
.therecontenttow {
margin-top: 32rpx;
.therecontenttow_one {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
.therecontenttow_tow {
font-size: 28rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: 500;
color: #333333;
}
}
}
.sixcontent {
width: 100%;
background: #FFFFFF;
padding: 32rpx;
margin-top: 32rpx;
border-radius: 12rpx;
.sixcontentone {
padding-bottom: 28rpx;
border-bottom: 1px solid #F7F7F7;
.sixcontent_one {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
}
.sixcontenttow {
.sixcontenttowitem {
margin-top: 16rpx;
.sixcontenttowitemone {
image {
margin-left: 24rpx;
width: 31.37rpx;
height: 27.34rpx;
}
.sixcontenttowitemonetext {
margin-left: 14rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
}
}
}
}
.fourcontent {
width: 100%;
background: #FFFFFF;
padding: 32rpx;
margin-top: 32rpx;
border-radius: 12rpx;
.fourcontentone {
padding-bottom: 28rpx;
border-bottom: 1px solid #F7F7F7;
.fourcontent_one {
font-size: 28rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
}
.fourcontenttow {
margin-top: 16rpx;
width: 100%;
/deep/ img {
width: 100%;
}
}
}
.u-popupflex-colum {
padding: 80rpx 40rpx;
border-radius: 50rpx;
background: #FFFFFF;
.u-popupflex-columview {
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #000;
font-weight: bold;
margin-bottom: 50rpx;
}
}
.fixedview {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
padding: 24rpx 28rpx;
background: #FFFFFF;
.fixedview_one {
.fixedview_oneone {
font-size: 28rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #333333;
}
.fixedview_onetow {
font-size: 44rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #F45C4C;
font-weight: bold;
text {
font-size: 28rpx;
}
}
}
.fixedview_tow {
background: var(--bg-color-button);
border-radius: 34rpx;
padding: 10rpx 44rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
}
}
</style>

341
pages/user/shop/detail.vue Normal file
View File

@@ -0,0 +1,341 @@
<template>
<view id="wrapper">
<view class="nav-wrap" :class="{ 'is-fixed': isFixed }"
:style="{ paddingTop: `${menuInfo.top}px`, paddingBottom: `${paddingBtmSize}px` }">
<view class="content" :style="{ height: `${menuInfo.height}px`, paddingLeft: `${paddingBtmSize}px` }">
<view class="left-btn">
<view class="btn" :style="{ width: `${menuInfo.height}px`, height: `${menuInfo.height}px` }"
@click="navClickHandle(1)">
<u-icon name="arrow-left" :color="isFixed ? '#333' : '#fff'" size="38"></u-icon>
</view>
<view class="left-btntitle"
:style="{ height: `${menuInfo.height}px`,lineHeight:`${menuInfo.height}px`}">
积分商城
</view>
</view>
</view>
</view>
<view class="shop-cover">
<image class="img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopindexnav.png" mode="widthFix">
</image>
<view class="shop-coverone" :style="{ paddingTop: `${menuInfo.top + menuInfo.height + 25}px`}">
<view class="shop-coveronebox flex-center">
<view style="margin-right: 10rpx;">
当前积分
</view>
<u-icon name="error-circle" color="#fff" size="32"></u-icon>
</view>
<view class="shop-coveroneboxnuber">
5830
</view>
</view>
</view>
<view class="shop_content">
<view class="shop_contenttitle">积分明细</view>
<!-- <view class="shop_contenbox flex-start">
<view class="shop_contenboxitem" :class="index == 0?'shop_contenboxitems':''"
v-for="(item,index) in shopcontenboxlsit" :key="index">
{{item.name}}
</view>
</view> -->
<view class="shop_contenlist">
<view class="shop_contenlistabsolute">
<view class="flex-start">
<text class="flex-starttext">收入</text>
/
<text>支出</text>
</view>
</view>
<view class="shop_contenlistitem flex-between" v-for="(item,index) in 6" :key="index">
<view class="shop_contenlistitemone flex-colum-start">
<view>交易积分-线下收款</view>
<view>2023-01-11 17:33:09</view>
</view>
<view class="shop_contenlistitemtow">+0.02</view>
</view>
</view>
</view>
</view>
</template>
<script>
import _ from 'lodash';
import navbar from '@/uni_modules/uview-ui/libs/config/props/navbar';
export default {
data() {
return {
menuInfo: uni.getMenuButtonBoundingClientRect(),
paddingBtmSize: 6,
isFixed: false,
active: 0,
titleTopNums: [],
shopcontenboxlsit: [{
name: '全部'
},
{
name: '交易积分'
}, {
name: '活动积分'
}, {
name: '任务积分'
}
]
};
},
onPageScroll(e) {
if (e.scrollTop >= (this.menuInfo.top + this.menuInfo.height + this.paddingBtmSize) / 2) {
this.isFixed = true;
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
});
} else {
this.isFixed = false;
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#000000'
});
}
this.countScrollTitle(e.scrollTop);
},
onLoad(e) {
// #ifdef APP-PLUS || H5
uni.getSystemInfo({
success: (res) => {
console.log(res)
this.menuInfo = res
}
})
// #endif
// #ifdef MP-WEIXIN
this.menuInfo = uni.getMenuButtonBoundingClientRect()
// #endif
},
onUnload() {
},
methods: {
// 导航栏点击
navClickHandle(t) {
switch (t) {
case 1:
// 返回
uni.switchTab({
url: '/pages/index/index'
})
break;
default:
break;
}
},
countScrollTitle: _.throttle(function(top) {
if (this.titleTopNums.length > 1) {
for (let i = 0; i <= this.titleTopNums.length - 1; i++) {
if (top >= this.titleTopNums[i] && top < this.titleTopNums[i + 1]) {
this.titleTopNumIndex = i;
}
}
if (top >= this.titleTopNums[this.titleTopNums.length - 1]) {
this.titleTopNumIndex = this.titleTopNums.length - 1;
}
}
}, 100),
}
};
</script>
<style scoped lang="scss">
$bg: #fafafa;
$tabLeft: 200upx;
$itemH: 100upx;
$cartH: 90upx;
.nav-wrap {
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 97;
&.is-fixed {
background-color: #fff;
}
.content {
position: relative;
.left-btn {
display: flex;
.btn {
display: flex;
align-items: center;
justify-content: center;
margin-right: $paddingSize;
}
}
.left-btntitle {
position: absolute;
top: 0;
left: 0;
width: 100%;
text-align: center;
font-family: SourceHanSansCN-Bold, SourceHanSansCN-Bold;
font-weight: normal;
font-size: 36rpx;
color: #FFFFFF;
}
}
}
.shop-cover {
position: relative;
z-index: 1;
// &::after {
// content: '';
// width: 100%;
// height: 100%;
// position: absolute;
// top: 0;
// left: 0;
// z-index: 2;
// background-color: rgba(0, 0, 0, 0.3);
// }
.img {
width: 100%;
height: 100%;
position: relative;
z-index: 1;
}
.shop-coverone {
position: absolute;
top: 0;
left: 0;
padding: 0rpx 32rpx;
z-index: 2;
.shop-coveronebox {
padding: 6rpx 10rpx;
background: rgba(255, 255, 255, 0.2);
border-radius: 58rpx 58rpx 58rpx 58rpx;
font-family: PingFangSC-Semibold, PingFangSC-Semibold;
font-weight: normal;
font-size: 28rpx;
color: #FFFFFF;
}
.shop-coveroneboxnuber {
margin-top: 32rpx;
font-family: Roboto, Roboto;
font-weight: 400;
font-size: 74rpx;
color: #FFFFFF;
}
}
}
.shop_content {
background: #FFFFFF;
border-radius: 26rpx 26rpx 0rpx 0rpx;
position: relative;
z-index: 5;
top: -92rpx;
.shop_contenttitle {
padding: 16rpx 0;
width: 100%;
text-align: center;
font-family: SourceHanSansCN-Medium, SourceHanSansCN-Medium;
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.shop_contenbox {
padding: 0 60rpx;
.shop_contenboxitem:nth-child(1) {
margin-left: 0;
}
.shop_contenboxitem {
margin-left: 24rpx;
padding: 6rpx 10rpx;
background: #F9F9F9;
border-radius: 8rpx 8rpx 8rpx 8rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
font-size: 28rpx;
color: #666666;
}
.shop_contenboxitems {
background: #F1CB66;
color: #FFFFFF;
}
}
.shop_contenlist {
position: relative;
margin-top: 32rpx;
background: #fff;
.shop_contenlistabsolute {
position: absolute;
top: -32rpx;
right: 32rpx;
.flex-start {
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
font-size: 24rpx;
color: #999999;
.flex-starttext {
color: #FF981E;
}
}
}
.shop_contenlistitem {
padding: 32rpx 44rpx;
border-bottom: 2rpx solid #E5E5E5;
.shop_contenlistitemone {
view:nth-child(1) {
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
font-size: 28rpx;
color: #666666;
}
view:nth-child(2) {
margin-top: 16rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
font-size: 28rpx;
color: #999999;
}
}
.shop_contenlistitemtow {
font-family: SourceHanSansCN-Medium, SourceHanSansCN-Medium;
font-weight: normal;
font-size: 32rpx;
color: #FF981E;
}
}
}
}
</style>

418
pages/user/shop/index.vue Normal file
View File

@@ -0,0 +1,418 @@
<template>
<view id="wrapper">
<view class="nav-wrap" :class="{ 'is-fixed': isFixed }"
:style="{ paddingTop: `${menuInfo.top}px`, paddingBottom: `${paddingBtmSize}px` }">
<view class="content" :style="{ height: `${menuInfo.height}px`, paddingLeft: `${paddingBtmSize}px` }">
<view class="left-btn">
<view class="btn" :style="{ width: `${menuInfo.height}px`, height: `${menuInfo.height}px` }"
@click="navClickHandle(1)">
<u-icon name="arrow-left" :color="isFixed ? '#333' : '#fff'" size="38"></u-icon>
</view>
<view class="left-btntitle"
:style="{ height: `${menuInfo.height}px`,lineHeight:`${menuInfo.height}px`}">
积分商城
</view>
</view>
</view>
</view>
<view class="shop-cover">
<image class="img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopindexnav.png" mode="widthFix">
</image>
<view class="shop-coverone" :style="{ paddingTop: `${menuInfo.top + menuInfo.height + 25}px`}">
<view class="shop-coveronebox flex-start">
<image src="@/static/shop/weitu.png" mode="aspectFill"></image>
<view style="margin-left: 10rpx;">
当前积分
</view>
</view>
<view class="shop-coveroneboxnuber">
5830
</view>
<navigator url="/pages/user/shop/detail" hover-class="navigator-hover"
class="shop-coveroneboxdetail flex-start">
<view style="margin-right: 20rpx;">
积分明细
</view>
<u-icon name="arrow-right" color="#666666" size="28"></u-icon>
</navigator>
<view class="shop-coveroneinput flex-start">
<u-search shape="round" searchIconSize='32rpx' height='100%' bgColor='#fff' placeholder="请输入商品"
:animation="true" :clearabled="true" v-model="keyword"></u-search>
<view class="shop-coveroneinputsouso">
搜索
</view>
</view>
</view>
</view>
<view class="shop_content">
<view class="shop_contenttitle">
<view class="shop_contenttitleitem" :class="index == 1?'shop_contenttitleitems':''"
v-for="(item,index) in shopcontenboxlsit" :key="index">
{{item.name}}
</view>
</view>
<view class="shop_contentlist flex-between">
<view class="shop_contentlistitem flex-colum-start" @click="clickshopinfo(item)"
v-for="(item,index) in 4" :key="index">
<image class="shop_contentlistitemimage" src="@/static/avatar.png" mode="aspectFill"></image>
<view class="shop_contentlistitemone">
澳洲高级洗发水
</view>
<view class="shop_contentlistitemtow flex-start">
<image src="@/static/shop/weitu.png" mode="aspectFill"></image>
<view>
30积分
</view>
</view>
<view class="shop_contentlistitemthere flex-between">
<view>
市场价¥100.00
</view>
<view>
已兑换0390件
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import _ from 'lodash';
import navbar from '@/uni_modules/uview-ui/libs/config/props/navbar';
export default {
data() {
return {
keyword: '',
menuInfo: {},
paddingBtmSize: 6,
isFixed: false,
active: 0,
titleTopNums: [],
shopcontenboxlsit: [{
name: '全部'
},
{
name: '交易积分'
}, {
name: '活动积分'
}, {
name: '任务积分'
}, {
name: '任务积分'
}, {
name: '任务积分'
}, {
name: '任务积分'
}, {
name: '任务积分'
}
]
};
},
onPageScroll(e) {
if (e.scrollTop >= (this.menuInfo.top + this.menuInfo.height + this.paddingBtmSize) / 2) {
this.isFixed = true;
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
});
} else {
this.isFixed = false;
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#000000'
});
}
this.countScrollTitle(e.scrollTop);
},
onLoad() {
// #ifdef APP-PLUS || H5
uni.getSystemInfo({
success: (e) => {
console.log(e)
this.menuInfo = e
}
})
// #endif
// #ifdef MP-WEIXIN
this.menuInfo = uni.getMenuButtonBoundingClientRect()
// #endif
},
onUnload() {
},
methods: {
clickshopinfo(item) {
uni.pro.navigateTo('user/shop/shopinfo', {
item: item
})
},
// 导航栏点击
navClickHandle(t) {
switch (t) {
case 1:
// 返回
uni.switchTab({
url: '/pages/index/index'
})
break;
default:
break;
}
},
countScrollTitle: _.throttle(function(top) {
if (this.titleTopNums.length > 1) {
for (let i = 0; i <= this.titleTopNums.length - 1; i++) {
if (top >= this.titleTopNums[i] && top < this.titleTopNums[i + 1]) {
this.titleTopNumIndex = i;
}
}
if (top >= this.titleTopNums[this.titleTopNums.length - 1]) {
this.titleTopNumIndex = this.titleTopNums.length - 1;
}
}
}, 100),
}
};
</script>
<style scoped lang="scss">
$bg: #fafafa;
$tabLeft: 200upx;
$itemH: 100upx;
$cartH: 90upx;
page {
background: #fff;
}
.nav-wrap {
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 97;
&.is-fixed {
background-color: #fff;
}
.content {
position: relative;
.left-btn {
display: flex;
.btn {
display: flex;
align-items: center;
justify-content: center;
margin-right: $paddingSize;
}
}
.left-btntitle {
position: absolute;
top: 0;
left: 0;
width: 100%;
text-align: center;
font-family: SourceHanSansCN-Bold, SourceHanSansCN-Bold;
font-weight: normal;
font-size: 36rpx;
color: #FFFFFF;
}
}
}
.shop-cover {
position: relative;
z-index: 1;
// &::after {
// content: '';
// width: 100%;
// height: 100%;
// position: absolute;
// top: 0;
// left: 0;
// z-index: 2;
// background-color: rgba(0, 0, 0, 0.3);
// }
.img {
width: 100%;
height: 100%;
position: relative;
z-index: 1;
}
.shop-coverone {
position: absolute;
width: 100%;
top: 0;
left: 0;
padding: 0rpx 32rpx;
z-index: 2;
.shop-coveronebox {
font-family: PingFangSC-Semibold, PingFangSC-Semibold;
font-weight: normal;
font-size: 28rpx;
color: #333333;
image {
width: 28rpx;
height: 28rpx;
}
}
.shop-coveroneboxnuber {
margin-top: 8rpx;
font-family: Roboto, Roboto;
font-weight: bold;
font-size: 74rpx;
color: #333333;
}
.shop-coveroneboxdetail {
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
font-size: 28rpx;
color: #666666;
}
.shop-coveroneinput {
margin-top: 32rpx;
background: #FFFFFF;
border-radius: 38rpx 38rpx 38rpx 38rpx;
height: 64rpx;
line-height: 64rpx;
.shop-coveroneinputsouso {
border-left: 2rpx solid #E8E8E8;
height: 100%;
padding: 4rpx 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
font-size: 28rpx;
line-height: 60 rpx;
color: #666666;
}
}
}
}
.shop_content {
position: relative;
top: 0rpx;
margin-top: -24rpx;
z-index: 3;
width: 100%;
background: #FFFFFF;
border-radius: 32rpx 32rpx 0rpx 0rpx;
padding: 0 28rpx 28rpx 28rpx;
.shop_contenttitle {
width: 100%;
padding-top: 32rpx;
display: flex;
justify-content: flex-start;
align-items: center;
overflow-x: scroll;
white-space: nowrap;
.shop_contenttitleitem:nth-child(1) {
margin-left: 0;
}
.shop_contenttitleitem {
margin-left: 18rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
font-size: 32rpx;
color: #666666;
}
.shop_contenttitleitems {
color: #FF981E;
}
}
.shop_contentlist {
.shop_contentlistitem {
margin-top: 32rpx;
width: 48%;
background: #FFFFFF;
box-shadow: 0rpx 2rpx 4rpx 2rpx rgba(0, 0, 0, 0.16);
border-radius: 18rpx 18rpx 18rpx 18rpx;
.shop_contentlistitemimage {
width: 100%;
height: 296rpx;
border-radius: 18rpx 18rpx 0 0;
}
.shop_contentlistitemone {
padding: 16rpx 16rpx 0 16rpx;
width: 100%;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-weight: normal;
font-size: 28rpx;
color: #333333;
}
.shop_contentlistitemtow {
padding: 16rpx 16rpx 0 16rpx;
image {
width: 28rpx;
height: 28rpx;
}
view {
margin-left: 6rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN-Medium;
font-weight: normal;
font-size: 24rpx;
color: #FF981E;
}
}
.shop_contentlistitemthere {
padding: 16rpx;
width: 100%;
view:nth-child(1) {
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
font-size: 20rpx;
color: #999999;
text-align: center;
font-style: normal;
text-decoration-line: line-through;
text-transform: none;
}
view:nth-child(2) {
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
font-size: 20rpx;
color: #999999;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,560 @@
<template>
<view class="content">
<image class="contentimage" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/ewm.png" mode="aspectFill"></image>
<view class="contentbox">
<view class="contentbox_one">
111
</view>
<view class="contentbox_tow flex-start">
<image src="@/static/shop/weitu.png" mode="aspectFill"></image>
<view style="margin-left: 10rpx;">
当前积分
</view>
</view>
</view>
<view class="contentboxtow">
<view class="onecontentterewone flex-start">
<view class="onecontenttereone_one">
商品详情
</view>
</view>
<!-- <view class="introduction_yow" v-html="list.details">
</view> -->
</view>
<view :style="{height:height}">
</view>
<view class="fixedview flex-between">
<view class="fixedview_letr flex-start">
<view class="fixedview_letr_item flex-colum" @click="eeInfoindex">
<image src="@/static/shop/s.png" mode="aspectFill"></image>
<text>首页</text>
</view>
<view class="fixedview_letr_item flex-colum" @click="makePhoneCall">
<image src="@/static/shop/k.png" mode="aspectFill"></image>
<text>客服</text>
</view>
</view>
<view class="fixedview_tow flex-between">
<view class="fixedview_towtow" @click="overlayshowsboxs(2)">
立即购买
</view>
<!-- <view class="fixedview_towtow" style="background: #ccc;">
立即购买
</view> -->
</view>
</view>
<u-overlay :show="overlayshow">
<view class="warp">
<view class="rect" @tap.stop>
<view class="onerect flex-start">
<image class="onecontentone_image" src="@/static/shop/k.png" mode="aspectFill"></image>
<view class="nonecontentone_view flex-colum-start">
<text class="nonecontentone_view_one">贝尔纳干红葡萄酒</text>
<view class="nonecontentone_view_otow flex-start">
<image src="@/static/shop/weitu.png" mode="aspectFill"></image>
<view style="margin-left: 10rpx;">
当前积分
</view>
</view>
</view>
<view class="onerecticon" @click="overlayshow = false">
<u-icon @click="overlayshow = false" name="close-circle-fill" color="#000000"
size="32"></u-icon>
</view>
</view>
<view class="towrect" v-for="(item,n) in list.spec" :key="item.id">
<view class="towrect_one">
{{item.spec_name}}
</view>
<view class="flex-start">
<view class="towrect_tow" v-for="(item1,index1) in item.spec_options" :key="index1"
@click="overlayshowsbox(item1,index1)">
<view
:class="[item1.isShow?'noneActive':'',towrecttowclass == index1?'towrect_towtext':'towrect_towtexts']">
{{item1.name}}
</view>
</view>
</view>
</view>
<view class="thererect flex-between">
<view class="thererect_one">
购买数量
</view>
<view class="thererect_tow">
<u-number-box v-model="numberbox" :min="1" button-size="24" color="#ffffff"
:bgColor="theme.cartpieces" iconStyle="color: #fff" integer></u-number-box>
</view>
</view>
<view class="fuorrect flex-between">
<view class="fuorrect_one">
合计
</view>
<view class="fuorrect_tow">
¥100
</view>
</view>
<view class="fvirect flex-center" @click="requestSubscribeMessage">
确定
</view>
</view>
</view>
</u-overlay>
</view>
</template>
<script>
export default {
data() {
return {
goods_id: '',
overlayshow: false,
towrecttowclass: 0,
numberbox: 1,
list: {},
height: '',
lsitform: {},
selectArr: [], //存放被选中的值
shopItemInfo: {}, //存放要和选中的值进行匹配的数据
subIndex: [], //是否选中 因为不确定是多规格还是单规格,所以这里定义数组来判断
}
},
computed: {},
onLoad(e) {
this.goods_id = e.id
},
onShow() {},
mounted() {
//#ifdef MP-WEIXIN || H5
var query = uni.createSelectorQuery().in(this).select('.fixedview')
query.boundingClientRect(ele => {
var that = this;
uni.getSystemInfo({
success(res) {
that.height = (ele.height) + "px";
that = null;
}
})
}).exec();
//#endif
//#ifdef MP-ALIPAY
my.createSelectorQuery().selectAll('.fixedview').boundingClientRect().exec(ele => {
var nodeData = ele[0]
var that = this;
that.height = (nodeData.height) + "px";
that = null;
})
//#endif
},
methods: {
makePhoneCall() {
uni.makePhoneCall({
phoneNumber: this.list.mobile //打电话
});
},
overlayshowsboxs(e) {
this.cartshping = e
this.overlayshow = true
},
async overlayshowsbox(item1, index1) {
this.towrecttowclass = index1
this.lsitform = item1
this.lsitform.title_name = item1.title_name
// this.lsitform.name = item1.name
console.log(this.lsitform)
},
async requestSubscribeMessage() {
// if (this.lsitform.id == '' || this.lsitform.id == null) {
// uni.showToast({
// title: '请选择合法规格',
// icon: 'none'
// });
// return false;
// }
// if (this.cartshping == 1) {
// this.$u.debounce(this.shoppingindexgoodindexsaddcar(), 200);
// } else {
uni.pro.navigateTo('user/shop/confirm', {
type: 2, // 1购物车 2商品详情页
goods_id: this.goods_id, //商品ID 商品详情页来源时必填
car_id: '', //购物车ID 1,2 购物车来源时必填
number: this.numberbox, //商品详情页来源时必填
spec: this.lsitform.name, //规格 商品详情页来源时必填
address_id: '', //地址ID 可以为空(为空时返回默认地址)
})
// }
},
async shoppingindexgoodindexsaddcar() {
let res = await this.api.shoppingindexgoodindexsaddcar({
number: this.numberbox,
goods_id: this.goods_id,
spec: this.lsitform.name,
})
if (res == 1) {
this.overlayshow = false
console.log(res)
uni.showToast({
title: '添加购物车成功',
icon: 'none'
});
}
},
eeInfoindex() { //去首页
uni.pro.navigateTo('user/shop/index')
},
async shoppingindexgoodsgoodsdetail() {
let res = await this.api.shoppingindexgoodsgoodsdetail({
goods_id: this.goods_id
})
this.list = res
this.lsitform = res.spec[0]
this.lsitform.title_name = res.spec[0].title
this.lsitform.img = res.host_img
this.list.details = res.details.replace(/style\s*?=\s*?(["])[\s\S]*?\1/ig,
'style="max-width:100%;height:auto;"') // 替换style
},
}
}
</script>
<style lang="scss" scoped>
page {
background: #F6F6F6;
}
.fixedview {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
padding: 24rpx 28rpx;
background: #FFFFFF;
.fixedview_letr {
.fixedview_letr_item:nth-child(1) {
margin: 0;
}
.fixedview_letr_item {
margin-left: 32rpx;
image {
width: 40rpx;
height: 40rpx;
}
text {
margin-top: 8rpx;
font-size: 20rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
}
}
.fixedview_one {
.fixedview_oneone {
font-size: 28rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #333333;
}
.fixedview_onetow {
font-size: 44rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #F45C4C;
font-weight: bold;
text {
font-size: 28rpx;
}
}
}
.fixedview_tow {
flex: auto;
padding-left: 24rpx;
.fixedview_towone {
// width: 50%;
// font-size: 28rpx;
// font-family: Source Han Sans CN-Bold, Source Han Sans CN;
// font-weight: bold;
// color: var(--cart-text-color);
// height: 72rpx;
// line-height: 72rpx;
// text-align: center;
// border-radius: 50rpx 0 0 50rpx;
// background: var(--cart-background-color);
}
.fixedview_towtow {
width: 100%;
font-size: 28rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
height: 72rpx;
line-height: 72rpx;
text-align: center;
border-radius: 50rpx;
background: #F1CB66;
}
}
}
.warp {
position: relative;
height: 100%;
.rect {
position: absolute;
bottom: 0;
width: 100%;
background: #FFFFFF;
border-radius: 60rpx 60rpx 0px 0px;
padding: 48rpx 32rpx 32rpx 32rpx;
.onerect {
position: relative;
padding-bottom: 34rpx;
border-bottom: 1rpx solid #F7F7F7;
image {
width: 124rpx;
height: 124rpx;
}
.nonecontentone_view {
margin-left: 16rpx;
.nonecontentone_view_one {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 32rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #1A1A1A;
}
.nonecontentone_view_otow {
margin-top: 10rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN-Medium;
font-weight: normal;
font-size: 28rpx;
color: #FF981E;
image {
width: 28rpx;
height: 28rpx;
}
}
}
.onerecticon {
position: absolute;
top: 0;
right: 0;
}
}
.towrect {
padding-bottom: 34rpx;
border-bottom: 1rpx solid #F7F7F7;
padding-top: 34rpx;
.towrect_one {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #1A1A1A;
}
.towrect_tow {
margin-top: 16rpx;
margin-left: 10rpx;
.noneActive {
background-color: #ccc;
opacity: 0.4;
color: #000;
pointer-events: none;
}
.towrect_towtext {
width: 100%;
background: #FFFFFF;
border-radius: 8rpx;
border: 1rpx solid #4F5066;
padding: 8rpx 26rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #4F5066;
}
.towrect_towtexts {
width: 100%;
background: #F7F7F7;
border-radius: 8rpx;
padding: 8rpx 26rpx;
font-size: 28rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
color: #4F5066;
}
}
}
.thererect {
padding: 34rpx 0;
border-bottom: 1rpx solid #F7F7F7;
border-top: 1rpx solid #F7F7F7;
.thererect_one {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #1A1A1A;
}
.thererect_tow {}
}
.fuorrect {
margin-top: 32rpx;
.fuorrect_one {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #1A1A1A;
}
.fuorrect_tow {
font-weight: bold;
font-size: 32rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
color: #333333;
}
}
.fvirect {
margin-top: 200rpx;
padding: 16rpx;
text-align: center;
background: #F1CB66;
border-radius: 40rpx;
font-size: 36rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
}
}
.content {
.contentimage {
width: 100%;
height: 528rpx;
}
.contentbox {
padding: 28rpx 32rpx;
width: 100%;
background: #FFFFFF;
.contentbox_one {
font-size: 32rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #1A1A1A;
}
.contentbox_tow {
margin-top: 12rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN-Medium;
font-weight: normal;
font-size: 28rpx;
color: #FF981E;
image {
width: 28rpx;
height: 28rpx;
}
}
}
.contentboxtow {
margin-top: 14rpx;
width: 100%;
padding: 28rpx 32rpx;
background: #FFFFFF;
.onecontentterewone::before {
content: '';
display: inline-block;
width: 4rpx;
height: 24rpx;
background: #febc46;
border-radius: 4rpx;
}
.onecontentterewone {
.onecontenttereone_one {
margin-left: 16rpx;
font-size: 32rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #1A1A1A;
text {
color: #999999;
}
}
}
.introduction_yow {
margin-top: 18rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #1A1A1A;
width: 100%;
/deep/ [alt] {
width: 100%;
}
/deep/ img {
width: 100%;
}
img {
width: 100%;
}
/deep/ p {
width: 100%;
}
}
}
}
</style>