|
|
<template> <view> <!-- 商品信息 --> <self-line/> <view class="bg-white padding-tb-sm"> <skeleton :loading="skeletonLoading" :row="2" :showAvatar="false" :showTitle="true">
<view class="flex justify-between align-start padding-top-sm padding-lr"> <image v-if="orderDetails.goods.cover" :src="orderDetails.goods.cover" mode="aspectFill" style="width: 150rpx; height: 150rpx;"></image> <view class="flex-sub padding-left-sm"> <view class="bref-box margin-top-xs"> {{orderDetails.goods.name}} </view> <view class="flex justify-between"> <text class="block margin-top-sm text-gray text-sm">数量</text> <view class="flex align-center margin-top-sm"> <text class="cuIcon-move" @tap="reduce"></text> <input type="number" v-model="num" class="text-center margin-lr-sm radius" style="width: 60rpx; height: 50rpx;background-color: #f7f7fb;" /> <text class="cuIcon-add" @tap="add"></text> </view> </view> <view class="flex justify-between margin-top-sm"> <view class="text-red text-price text-lg"> {{Number(orderDetails.goods.specs[0].selling_price || 0)}} </view> <!-- <view> <button v-if="true" class="cu-btn line-orange round margin-left-sm text-sm">申请退款</button> <button v-else class="cu-btn line-gray bg-gray round margin-left-sm text-sm">退款中</button> </view> --> </view> </view> </view>
</skeleton> </view> <self-line/> <skeleton :loading="skeletonLoading" :row="1" :showAvatar="false" :showTitle="true"> <view class="bg-white"> <view class="cu-bar padding-lr solid-bottom"> <text class="text-gray">优惠</text> <text>暂无优惠</text> </view> </view> </skeleton> <self-line/> <skeleton :loading="skeletonLoading" :row="13" :showAvatar="false" :showTitle="true"> <view class="btn-bottom"> <view class="padding flex justify-around align-center" v-if="orderDetails.agreement.tips"> <checkbox-group class="block" @change="CheckboxChange"> <view class="margin-right"> <checkbox @change="CheckboxChange" :class="checkbox[0].checked?'checked':''" :checked="checkbox[0].checked?true:false" value="A"></checkbox> </view> </checkbox-group> <view class="text-sm text-gray">{{orderDetails.agreement.tips}}</view> </view> <self-line/> <view class="padding-lr padding-tb-sm bg-white flex justify-between align-center solid-top shadow"> <view class="flex align-center"> <text class="">应付款:</text> <view class="text-lg text-price text-red"> {{Number(orderDetails.goods.specs[0].selling_price*num || 0)}} </view> </view> <button class="cu-btn block bg-orange round shadow" @tap="submit"> <text class="cuIcon-loading2 cuIconfont-spin margin-right-xs text-white" v-if="loading"></text> <text class="text-df text-white">{{ loading ? '支付中...' : '下单付款' }}</text> </button> </view> </view> </skeleton> </view></template>
<script> import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; export default { mixins: [MescrollMixin], // 使用mixin
data() { return { num: 1, base64Img: '', //
skeletonLoading: true, loading: false, checkbox: [{ value: 'A', checked: true }], goods_id: 1, goods_specs_id: 1, orderDetails: {}, ifchoose: true } }, computed: { total(){ return this.num * this.price } }, onLoad(e) { this.goods_id = e.goods_id this.goods_specs_id = e.goods_specs_id }, methods: { getConfirmOrder() { this.$http(this.API.API_COFIRMORDER_DETAILS, {goods_id: this.goods_id,goods_specs_id: this.goods_specs_id}).then(res => { if(res.code == 0) { this.orderDetails = res.data this.skeletonLoading = false this.mescroll.endSuccess(); // 请求成功,隐藏加载状态
}else { this.$msg(res.msg) } }).catch(err => { // this.mescroll.endErr();
}); }, reduce() { if (this.num === 1) return this.num-- }, add() { this.num++ }, CheckboxChange(e) { if(e.detail.value != '') { this.ifchoose = true }else { this.ifchoose = false } }, // 点击复制
copy(text) { uni.setClipboardData({ data: text }); }, submit(){ if(this.ifchoose == true) { this.$http(this.API.API_PRPAID, { goods_id: this.goods_id, goods_specs_id: this.goods_specs_id, number: this.num, token: 'fdf12000e774e48bc60c6b6d42055602' }).then(res => { console.log(res) // let nonceStr = res.data.nonceStr
// appId: "wxb35ef055a4dd8ad4"
// nonceStr: "60d3125d138af"
// order_num: "2842855348400816128"
// package: "prepay_id=wx23185213000285e14ea77ac97acc670000"
// paySign: "6DC330CBDF6C29BEDD4D254D9DA97364"
// signType: "MD5"
// timeStamp: "1624445533"
uni.requestPayment({ orderInfo: res.data.order_num, timeStamp: res.data.timeStamp, nonceStr: res.data.nonceStr, package: res.data.package, signType: res.data.signType, paySign: res.data.paySign, complete: result => { console.log(result) } }) }) return this.$routerGo('/pages/order/pay-success') }else { this.$msg('请认真阅读并同意协议!') return } }, //下拉刷新
downCallback() { this.getConfirmOrder() }, }, created() { this.getConfirmOrder() } }</script>
<style lang="scss" scoped> .bref-box { text-overflow: -o-ellipsis-lastline; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }</style>
|