| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <view class="order-container" style="width: 100%;" :class="{ 'large-size': size === 'large' }">
- <view class="order-return-actions">
- <button v-if="status == 0" class="action-btn" @click.stop="handleAction('pay')">去付款</button>
- <!-- 待初审 -->
- <template v-if="status == 2 || status == 1">
- <button class="action-btn" @click.stop="handleAction('cancel')">取消退回</button>
- </template>
- <!-- 待取件 -->
- <button v-if="status === 2" class="action-btn" @click.stop="handleAction('confirm')">确认收货</button>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'OrderActions',
- props: {
- status: {
- type: Number,
- required: true
- },
- order: {
- type: Object,
- default: () => ({})
- },
- size: {
- type: String,
- default: 'normal'
- }
- },
- methods: {
- handleAction(type) {
- if (type == 'pay') {
- //先校验支付参数
- if (this.order.orderId) {
- uni.$u.http.post('/token/order/refundGoPay', {
- refundOrderId: this.order.orderId
- }).then(res => {
- if (res.code == 200) {
- //如果有微信订单,则跳转去微信支付
- if (res.data.prepayId) {
- uni.requestPayment({
- timeStamp: res.data.timeStamp,
- nonceStr: res.data.nonceStr,
- package: `prepay_id=${res.data.prepayId}`,
- signType: res.data.signType,
- paySign: res.data.paySign,
- provider: 'wxpay',
- success: (res) => {
- console.log(res)
- //支付成功之后,跳转支付成功页面
- uni.navigateTo({
- url: `/pages-mine/pages/pay-success?orderId=${this.order.orderId}`
- })
- },
- fail: (err) => {
- console.log(err)
- }
- })
- } else {
- uni.navigateTo({
- url: `/pages-mine/pages/cashier-desk?id=${res.data.refundOrderId}`
- })
- }
- }
- })
- }
- } else {
- this.$emit('action', {
- type,
- order: this.order
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .order-return-actions {
- display: flex;
- justify-content: flex-end;
- gap: 10px;
- padding: 10px 0;
- width: 100%;
- .w-full {
- width: 100%;
- }
- .action-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- min-width: 160rpx;
- height: 60rpx;
- line-height: 60rpx;
- border-radius: 10rpx;
- font-size: 28rpx;
- background-color: #38C148;
- color: #ffffff;
- cursor: pointer;
- margin: 0;
- border: 0;
- max-width: 200rpx;
- &::after {
- border: 0;
- }
- &+.action-btn {
- margin-left: 16rpx;
- }
- &.info-btn {
- background-color: #DBDBDB;
- color: #ffffff;
- }
- &.plain {
- border: 1px solid #38C148;
- color: #38C148;
- background-color: #fff;
- }
- }
- }
- .large-size {
- .order-return-actions {
- .action-btn {
- max-width: 200rpx;
- height: 80rpx;
- line-height: 80rpx;
- }
- }
- }
- </style>
|