Files
BlockChainH5/pages/user/order/numberWeightInfo.vue
2021-11-03 16:56:06 +08:00

823 lines
18 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="OrderInfo" v-if="loaded">
<!-- 订单状态 -->
<view class="order-status">
<view class="info">
待提货
<span>确认提货后快递会坐着火箭朝您飞来</span>
</view>
<image src="/static/imgs/fire.png" mode="widthFix" />
</view>
<!-- 收货人 -->
<view class="acceptInfo" v-if="type === '1'">
<navigator v-if='!!address.name' url="/pages/user/address/list?type=1" hover-class="none">
<view class="name">{{address.name}} <span>{{address.mobile}}</span> </view>
<view class="address">
<u-icon name="map" color="red"></u-icon>
<span>{{address.full_address}}</span>
</view>
</navigator>
<navigator v-else class="no-address selectNew" url="/pages/user/address/list?type=1" hover-class="none">
<u-icon name="map-fill" color="#613091" size="40" label='选择收货地址' />
</navigator>
</view>
<view class="goods-info1">
<view class="top">
<view class="company">
<view class="company-logo">
<image :src="shop.cover" mode="aspectFill" />
<view class="name ellipsis">{{shop.name}}</view>
</view>
<view class="flexrow">
<view class="no ellipsis">区块链地址 {{account.addr}}</view> <span class="copy"
@click='copy(account.addr)'>复制</span>
</view>
</view>
</view>
<view class="goods-info">
<image class="goods-img" :src="goods.cover" mode="aspectFill" />
<view class="goods">
<view class="name">
<view class="name1 ellipsis-2">{{goods.goods_name}}</view>
<!-- <span>16.80</span> -->
</view>
<view class="sku">可提个数 <span>x {{account.balance}}</span> </view>
</view>
</view>
<navigator class="total" hover-class="none" :url='"/pages/goods/details?id="+goods.goods_id'>
<view class="total-btn">再次购买</view>
</navigator>
<view class="goods-type" v-if="type === '1'">运费 <span>免邮</span></view>
<view class="goods-type">提货数量 <span>
<u-number-box v-model="qty" :min='1' :max='account.balance'></u-number-box>
</span></view>
<view class="goods-type">提货方式
<u-radio-group v-model="type" @change="radioGroupChange">
<u-radio v-for="(item, index) in list" :key="index" :name="item.id" :disabled="type !== item.id">
{{item.name}}
</u-radio>
</u-radio-group>
</view>
<!-- 不显示了就 -->
<view class="goods-type" v-if="type === '100'">
提货门店
<view class="goods-type-address" @click="showStoreList = true">
{{store_Name!==''?store_Name:'选择门店'}}
<u-icon name="arrow-right" color="#999" size="20" />
</view>
</view>
</view>
<!-- 订单 -->
<view class="actions">
<view class="nowPay" @click="nowTake">{{type === '2'?'生成提货二维码':'确认提货'}}</view>
</view>
<!-- 优惠券弹窗 -->
<u-popup v-model="showStoreList" mode="bottom" border-radius="14">
<scroll-view scroll-y="true" style="height: 1000rpx;" class="scrollView">
<view class="coupon-title">可提货门店</view>
<view class="coupon-list-item" v-for="(item,index) in stores" :key="index" v-if="stores.length>0">
<u-icon v-if="store_id!== item.store_id" name="checkmark-circle" color="#cacaca" size="50" />
<u-icon v-else name="checkmark-circle-fill" color="#2979ff" size="50" />
<!-- 遮挡层用户控制点击事件 -->
<view class="list-top">
<view class="list-top-left">
<image :src="item.cover" mode="aspectFill" class="list-banner"></image>
<view class="shop-info">
<view class="title ellipsis">{{item.name}}</view>
<view class="des" style="padding-top: 12rpx;">营业时间{{item.opening_time}}</view>
<view class="des" style="padding-top: 4rpx;">门店地址{{item.address}}</view>
</view>
</view>
</view>
<view class="coupon-list-item" @click="selectStore(item)"></view>
</view>
<!-- 没有优惠券列表 -->
<no-list v-if="stores.length === 0" name='no-shop' txt="没有任何门店哦~" />
</scroll-view>
</u-popup>
<!-- 二维码展示动画效果 -->
<view class="showCode " v-if="showCode">
<view class="showCodeBg" @click="showCode = false"></view>
<view :class="['showCodeContent', showCode?'showCodeContentSelect':'showCodeContentSelectNo']">
<view class="showCodeTitle">提货二维码</view>
<image :src="showCodeImg" mode="widthFix"></image>
<view class="outTime">
<uni-countdown class="outTime-down" color="#8b64fd" splitorColor="#8b64fd" :showDay="false" :showHour="false" :minute="codeOutTime" @timeup="onTimeUp">
<template #PromptText>后过期</template>
</uni-countdown>
</view>
<view class="showCodeDes">此码请小心保管,丢失或被用不退不换</view>
</view>
</view>
<!-- <u-toast ref="uToast" /> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
mallWarrantsList,
mallWarrantsSure,
mallWarrantsQrcode
} from '@/apis/interfaces/numberWeight'
export default {
name: 'OrderInfo',
data() {
return {
symbol: '',
account: {},
address: {},
addresses: [],
goods: {},
shop: {},
stores: [],
list: [{
name: '快递',
disabled: false,
id: '1'
},
{
name: '自提',
disabled: false,
id: '2'
}
],
type: '', //提货类型2 自提 1 邮寄
showStoreList: false, // 默认false不显示优惠券弹窗列表
store_id: '', // 默认没有选择任何一个优惠券
store_Name: '', // 门店名称
qty: 1,
showCode:false,
showCodeImg: '',
codeOutTime: '',
loaded:false
};
},
onLoad(e) {
this.symbol = e.symbol
this.getInfo(e.symbol)
// this.getInfo('G22S20')
},
// 监听弹窗页面为false时候重新请求当前页面
watch: {
showCode(newVal, oldVal) {
if(!newVal && oldVal){
this.getInfo(this.symbol)
uni.setStorageSync('refresh',true)
}
}
},
methods: {
getInfo(symbol) {
mallWarrantsList(symbol).then(res => {
this.codeOutTime = res.validity
this.account = res.account
this.address = res.address
this.addresses = res.addresses
this.goods = res.goods
this.stores = res.stores
this.shop = res.shop
this.stores = res.stores
this.qty = res.account.balance
this.type = res.logistic_type + ''
this.loaded = true
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'error',icon:false,
duration: 3000
})
setTimeout(res => {
uni.setStorageSync('refresh',true)
uni.navigateBack({})
}, 2000)
})
},
// 选中任一radio时由radio-group触发
radioGroupChange(e) {
this.type = e
if (e === '2') {
this.store_id = ''
this.store_Name = ''
}
},
// 选择可用优惠券
selectStore(item) {
this.store_id = item.store_id
this.store_Name = item.name
this.showStoreList = false
},
// 确认提货
nowTake() {
let data = {
symbol: this.symbol,
type: this.type,
store_id: this.store_id || '',
qty: this.qty,
address_id: this.address.address_id || '',
}
if (data.type === '1') {
if (data.address_id === '') {
this.$refs.uToast.show({
title: '请添加收货地址',
type: 'error',icon:false,
duration: 3000
})
return;
}
data.store_id = ''
}
// 快递单继续沿用之前的信息
if (data.type === '1') {
mallWarrantsSure(data).then(res => {
this.$refs.uToast.show({
title: res,
type: 'error',icon:false,
duration: 3000,
})
uni.setStorageSync('refresh', true)
setTimeout(res => {
uni.navigateBack({})
}, 3000)
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'error',icon:false,
duration: 3000
})
})
}
// 提货或者服务单生成二维码
else {
mallWarrantsQrcode(data).then(res => {
this.showCodeImg = res.code
// uni.setStorageSync('refresh', true)
this.showCode = true
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'error',icon:false,
duration: 3000
})
})
}
},
// 复制
copy(e) {
uni.setClipboardData({
data: e,
success: () => {
}
})
},
// 倒计时
onTimeUp(e){
uni.showModal({
title: '提示',
content: '二维码已过期,请重新获取',
showCancel: false,
success: res => {
this.showCodeImg = ''
this.showCode = false
}
})
}
}
}
</script>
<style lang="scss" scoped>
page {
width: 100%;
height: 100%;
}
.OrderInfo {
width: 100%;
min-height: 100vh;
box-sizing: border-box;
background-color: #F7F7F7;
padding-bottom: 80rpx;
.order-status {
width: 100%;
height: 300rpx;
background-image: linear-gradient(to bottom, $mian-color, $mian-color-light);
color: #Fff;
font-size: 36rpx;
padding: 30rpx 50rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
.info {
font-size: 36rpx;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
box-sizing: border-box;
span {
font-size: 28rpx;
padding-top: 30rpx;
}
}
image {
width: 200rpx;
}
}
.acceptInfo {
margin: 0 30rpx;
background-color: #fff;
box-shadow: 0 0 14rpx 4rpx rgba($color: $mian-color, $alpha: 0.2);
border-radius: 20rpx;
padding: 30rpx;
position: relative;
top: -30rpx;
.name {
font-size: 36rpx;
font-weight: 600;
span {
padding-left: 20rpx;
font-size: 30rpx;
}
}
.address {
padding-top: 20rpx;
font-size: 28rpx;
span {
margin-left: 10rpx;
}
}
}
.goods-info1 {
padding: 20rpx 40rpx;
background-color: #fff;
.goods-type {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
border-bottom: solid 1rpx #f7f7f7;
}
.goods-type-address {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
u-icon {
padding-left: 20rpx;
}
}
// 顶部信息
.top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
border-bottom: solid 1rpx #EFF4F2;
.company-logo {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
image {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.name {
width: 600rpx;
font-size: 30rpx;
color: #484848;
font-weight: bold;
}
}
.no {
margin-top: 10rpx;
font-size: $title-size*0.8;
color: #999;
width: 500rpx;
}
.status {
color: #999;
font-size: $title-size;
}
}
// 商品信息
.goods-info {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
margin-top: 40rpx;
.goods-img {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
}
.goods {
flex: 1;
margin-left: 20rpx;
.name {
width: 100%;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
box-sizing: border-box;
font-size: 30rpx;
// font-weight: bold;
.name1 {
width: 500rpx;
}
span {
font-size: 34rpx;
font-weight: normal;
}
}
.sku {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
margin-top: 10rpx;
font-size: 28rpx;
color: #999;
}
}
}
// 合计信息
.total {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
font-size: 26rpx;
color: $mian-color;
flex: 1;
text-align: right;
margin-top: 20rpx;
padding-bottom: 30rpx;
}
.total-btn {
border: solid 1rpx $mian-color;
padding: 6rpx 20rpx;
border-radius: 10rpx;
}
}
// 操作信息
.actions {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
flex-wrap: wrap;
flex: 1;
font-size: 28rpx;
padding: 30rpx;
color: #fff;
.nowPay {
padding: 20rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
width: 600rpx;
font-size: 32rpx;
background-color: $mian-color;
text-align: center;
}
.cancelOrder {
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
background-color: #DD524D;
}
.logistics {
background-color: $mian-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.sign {
background-color: #DD524D;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
.evaluate {
background-color: $mian-color;
padding: 10rpx 30rpx;
border-radius: 40rpx;
margin-left: 20rpx;
margin-top: 20rpx;
}
}
}
.flexrow {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
width: 100%;
.copy {
color: $mian-color;
font-size: $title-size*0.8;
font-weight: 400;
padding: 0 30rpx;
}
}
.no-address {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
// 优惠券弹窗
.scrollView {
// padding: 40rpx;
box-sizing: border-box;
position: relative;
// 标题
.coupon-title {
padding: 40rpx;
font-weight: bold;
font-size: 40rpx;
border-bottom: solid 1rpx #f7f7f7;
}
// 优惠券样式
.coupon-list-item {
border-bottom: solid 1rpx #f7f7f7;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
position: relative;
width: 100%;
.coupon-list-item {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba($color: #000, $alpha: 0);
z-index: 10001;
}
}
}
.list-top {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
font-size: $title-size*0.94;
border-bottom: solid 1rpx #f7f7f7;
width: 600rpx;
margin-left: 30rpx;
.list-top-left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
.shop-info {
flex: 1;
}
.title {
width: 380rpx;
font-size: $title-size*1;
font-weight: 400;
}
.urate {
padding: 10rpx 0;
}
.des {
// padding-top: $padding*0.8;
font-size: $title-size * 0.8;
color: #999;
span {
color: #666;
padding: 0 10rpx;
}
}
.list-banner {
width: 120rpx;
margin-right: $margin*1.5;
height: 120rpx;
border-radius: 4rpx;
}
}
.list-top-right {
border: solid 1rpx $mian-color;
color: $mian-color;
display: inline-block;
padding: 8rpx 16rpx;
font-size: $title-size *0.8;
border-radius: 4rpx;
}
}
// 二维码展示
// 动画效果
.showCode {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
z-index: 1;
.showCodeBg {
background-color: rgba($color:#000, $alpha: 0.3);
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2;
}
.showCodeContentSelect {
animation: sk-foldCubeAngle .6s linear both;
}
.showCodeContentSelectNo {
animation: sk-foldCubeAngleNo .6s linear both;
}
.showCodeContent {
width: 600rpx;
minheight: 500rpx;
background-color: #fff;
border-radius: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 70rpx 30rpx;
margin-bottom: 10vh;
position: relative;
z-index: 199;
image {
width: 60%;
}
.showCodeTitle {
font-weight: 600;
padding-bottom: 20rpx;
font-size: 36rpx;
margin-bottom: 20rpx;
}
.showCodeDes{
padding: 20rpx 0 20rpx 0;
color: gray;
font-size: 24rpx;
}
.outTime{
padding: $padding 0 0;
.outTime-down{
color: $text-price;
font-size: 32rpx;
}
}
}
@keyframes sk-foldCubeAngle {
0% {
-webkit-transform: perspective(140px) rotateX(-180deg);
transform: perspective(140px) rotateX(-180deg);
opacity: 0;
}
100% {
-webkit-transform: perspective(140px) rotateX(0deg);
transform: perspective(140px) rotateX(0deg);
opacity: 1;
}
}
@keyframes sk-foldCubeAngleNo {
0% {
transform: scale(1);
opacity: 1;
}
25% {
transform: scale(0);
opacity: 0;
}
}
@keyframes turn {
0% {
-webkit-transform: rotate(0deg);
opacity: 1;
}
25% {
-webkit-transform: rotate(90deg);
opacity: .9;
}
50% {
-webkit-transform: rotate(180deg);
opacity: .8;
}
75% {
-webkit-transform: rotate(270deg);
opacity: .9;
}
100% {
-webkit-transform: rotate(360deg);
opacity: 1;
}
}
}
</style>