Compare commits

..

No commits in common. "002e507aaaaf70d14dfaae3a0a94266c31b908aa" and "44a4d393c65c550a667b1af78f94184e2bf7486f" have entirely different histories.

5 changed files with 20 additions and 139 deletions

24
App.vue
View File

@ -3,10 +3,8 @@
//
onLaunch: function(options) {
//id id
// this.$store.commit('setShopId', options.query.s);
// this.$store.commit('setSiteId', options.query.z);
this.$store.commit('setShopId', '2dc23dcfecc05fb1');
this.$store.commit('setSiteId', '13');
this.$store.commit('setShopId', options.query.s);
this.$store.commit('setSiteId', options.query.z);
//
this.$store.dispatch('fetchShopCon')
//
@ -57,19 +55,6 @@
float: right;
}
.fc {
text-align: center;
}
.fr {
text-align: right;
}
.checkBox {
weight: 40rpx;
height: 40rpx;
}
.ls {
background-color: #007aff;
}
@ -178,17 +163,14 @@
.flex4 {
flex: 4;
}
//
.boxshadow {
box-shadow: 0px 4rpx 4rpx rgba(0, 0, 0, 0.1);
}
//
.border {
border: 1rpx solid $uni-border-color;
}
//
.border4 {
border: 4rpx solid $uni-border-color;
@ -205,12 +187,10 @@
.borderno {
border: none;
}
// 线
.borderB {
border-bottom: 1rpx solid $uni-border-color;
}
// 线
.borderBDas{
border-bottom: 1rpx dashed $uni-border-color;

View File

@ -37,7 +37,8 @@
+{{priceDifference(sku.id) | formatPrice}}
</text>
</view>
<view class="border rad-c m-r-12 checkBox" :class="isSel(sku.id)?'border-m bg-m':''">
<view class="border rad-c m-r-12" :class="isSel(sku.id)?'border-m bg-m':''"
style="width: 40rpx;height: 40rpx;">
<u-icon name="checkbox-mark" size="40rpx" color="#fff" v-if="isSel(sku.id)"></u-icon>
</view>
</view>

View File

@ -188,7 +188,7 @@
//
uni.navigateTo({
url: `/pages/shop/pay?order_sn=${res.data.order_sn}&fullPrice=${fullPrice}`
})
});
} else if (res.data.status === -1) {
uni.removeStorage({ //
key: 'userInfo',

View File

@ -6,35 +6,15 @@
<u-icon name="arrow-left" color="#fff" size="19"></u-icon>
</view>
</u-navbar>
<!-- body -->
<view class="flex column msb bodyBox">
<view>
<view class="priceBox fb flex mc">¥{{fullPrice | formatPrice}}</view>
<view class="fcb fz24 flex mc">
<span class="m-r-24">支付剩余时间</span>
<span v-if="order_time!==0">{{ countdown }}</span>
</view>
<view class="flex msb mac rad8 bg-w m-l-24 m-r-24 m-t-24 p-24">
<view class="flex mac">
<u--image src="/static/icons/wxPayLogo.svg" width="75rpx" height="60rpx" />
<view class="fz36 m-l-24">微信支付</view>
</view>
<view class="flex border rad-c border-m bg-m checkBox">
<u-icon name="checkbox-mark" size="40rpx" color="#fff"></u-icon>
</view>
</view>
</view>
<view @click="pay" class="butBox fci bg-m rad8 fb fz36 flex mc p-24 m-l-24 m-r-24">确认支付</view>
<!-- <button @click="pay" type="primary">确认支付</button> -->
</view>
<!-- 价格 -->
<view>{{fullPrice | formatPrice}}</view>
<button @click="pay" type="primary" style="margin-top:200rpx;">确认支付</button>
</view>
</template>
<script>
import {
formatPrice,
formatSeconds
formatPrice
} from '@/utils/index.js'
export default {
@ -42,65 +22,19 @@
return {
order_sn: '', //
fullPrice: 0,//
order_time: 0, //
countdown: '', //
timer: null, //
}
},
onLoad(options) {
this.$store.dispatch('fetchOrderList')
this.order_sn = options.order_sn //
this.fullPrice = Number(options.fullPrice) //
//
this.timer = setInterval(() => {
if (this.order_time && this.order_time > 0) {
let tempTime = this.order_time + 100 - Math.floor(Date.now() / 1000)
if (tempTime <= 0) {
this.countdown = '00:00'
clearInterval(this.timer) //
//
uni.navigateTo({
url: '/pages/index/index' // Tab
})
} else {
this.countdown = this.formatSeconds(tempTime)
}
} else {
this.countdown = '00:00'
clearInterval(this.timer) //
// order_time
uni.switchTab({
url: '/pages/index/index' //
})
}
}, 1000)
},
computed: {
//
orderShow() {
if (this.$store.state.orderList && this.$store.state.orderList.length > 0) {
// 使 find null
return this.$store.state.orderList.find((item) => item.order_sn === this.order_sn) || null;
}
return null; // orderList null
this.order_sn = options.order_sn; //
this.fullPrice = Number(options.fullPrice); //
},
computed(){
},
filters: {
formatPrice, //
},
watch: {
'orderShow': {
handler(newVal, oldVal) {
if (newVal) {
this.order_time = Number(newVal.order_time)
}
},
deep: true
}
},
methods: {
// 00:00
formatSeconds,
//
pay() {
uni.$u.http.post('/Api/Pay/pay', {
@ -148,27 +82,10 @@
}
});
},
},
destroyed() {
//
clearInterval(this.timer) //
}
}
</script>
<style lang="scss" scoped>
.priceBox {
font-size: 72rpx;
margin-top: 140rpx;
}
<style>
.butBox {
margin-bottom: 72rpx;
}
.bodyBox {
height: calc(100vh - 176rpx);
}
</style>

View File

@ -75,23 +75,6 @@ export function formatTime(value) {
return `(${period})${hour}:${minute}`
}
/**
* 格式化秒数为 mm:ss 的格式
* @param {number} seconds 总秒数
* @returns {string} 格式化后的时间字符串
*/
export function formatSeconds(seconds) {
if (seconds < 0) return '00:00' // 如果秒数为负,则返回 00:00
let minutes = Math.floor(seconds / 60)
let remainingSeconds = seconds % 60
minutes = minutes.toString().padStart(2, '0')
remainingSeconds = remainingSeconds.toString().padStart(2, '0')
return `${minutes}:${remainingSeconds}`
}
/**
* 过滤价格数值 超过小数点两位得 保留两位
* @param {string} value