123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394 |
- <template>
- <view>
- <Loading :type="3" :loadStatus="loadStatus" :showText="errorText" />
- <zj-page-layout :hasFooter="true" v-if="detail">
- <view style="padding: 1rpx 30rpx">
- <view class="materials-container card mt30">
- <view class="title">
- <view class="t1">支付金额</view>
- <view class="t2"
- >¥<text>{{ detail.totalAmount | priceFilter }}</text></view
- >
- </view>
- <view class="id"><text>费用单号:</text>{{ detail.salesId }}</view>
- <view class="product">
- <view class="it" v-for="(item, index) in detail.items" :key="index">
- <view class="name"
- >{{ item.goodsName }}<text>×{{ item.salesQty }}{{ item.goodsSalesUnit }}</text></view
- >
- <view class="price">¥{{ item.saleAmount | priceFilter }}</view>
- </view>
- <view class="total">
- <view class="text">合计:</view>
- <view class="price">¥{{ detail.totalAmount | priceFilter }}</view>
- </view>
- </view>
- <view class="row"><text>备注:</text>{{ detail.remark }}</view>
- <!-- <view class="row"><text>操作人:</text>模式一</view> -->
- </view>
- <!-- <view class="pay-container card mt30">
- <view class="top">请选择客户支付方式</view>
- <view class="item">
- <view class="left">
- <text class="iconfont icon-weixinzhifu"></text>
- <text class="text">微信支付</text>
- </view>
- <view class="right">
- <text class="iconfont icon-danxuan2 active"></text>
- </view>
- </view>
- </view> -->
- <view class="pay-container card mt30">
- <view class="top">支付信息</view>
- <view class="item" v-for="(item, index) in payNoList" :key="index" @click="payNo = item.id">
- <view class="left">
- <text
- :class="{
- iconfont: true,
- 'icon-danxuan2': true,
- active: payNo === item.id
- }"
- ></text>
- </view>
- <view class="right">
- <text class="text">{{ item.name }}</text>
- </view>
- </view>
- </view>
- </view>
- <template slot="footer">
- <view class="footer-btn-group">
- <u-button text="取消订单" @click="cancelOrder"></u-button>
- <u-button text="确认支付" type="primary" @click="submitData"></u-button>
- </view>
- </template>
- </zj-page-layout>
- </view>
- </template>
- <script>
- import { weixinPay, mini_env } from '@/common/utils/util.js'
- export default {
- data() {
- return {
- orderId: null,
- refresherTriggered: false,
- loadStatus: 0,
- errorText: '',
- detail: null,
- canScanCode: 0,
- payNoList: [],
- payNo: '',
- websitId: '',
- goodsType: ''
- }
- },
- onLoad({ orderId, websitId, goodsType }) {
- this.orderId = orderId
- this.websitId = websitId
- this.goodsType = goodsType
- this.getDetail()
- this.$api
- .post('/material/salses/get/pay/config', {
- goodsType: this.goodsType,
- websitId: this.websitId
- })
- .then(res => {
- this.payNoList = res.data
- })
- },
- methods: {
- getDetail() {
- this.$api
- .post('/material/salses/detail', {
- salesId: this.orderId
- })
- .then(res => {
- this.detail = res.data
- this.loadStatus = 0
- })
- .catch(res => {
- this.errorText = res.message
- this.loadStatus = 2
- })
- .finally(res => {
- this.refresherTriggered = false
- })
- },
- // 取消订单
- cancelOrder() {
- this.$modal({
- content: '确认取消订单吗?'
- })
- .then(() => {
- this.$api
- .post('/material/salses/cancel', {
- salesId: this.orderId
- })
- .then(res => {
- this.$successToast()
- this.$navToPage(
- {
- delta: 1
- },
- 'navigateBack'
- )
- })
- })
- .catch(() => {})
- },
- // 下单
- submitData() {
- if (this.payNo) {
- mini_env(bool => {
- if (bool) {
- this.$api
- .postJson('/material/salses/save/pay/order', {
- salesId: this.orderId,
- payConfigId: this.payNo,
- miniPay: true,
- openId: this.$store.state.user.miniOpenId
- })
- .then(res => {
- uniWebview.navigateTo({
- url: `/pages/pay/otherPay?${Object.entries({
- appOrderId: res.data.appOrderId,
- appid: res.data.appid
- })
- .map(item => item.join('='))
- .join('&')}`
- })
- })
- } else {
- // 公众号支付
- // weixinPay(res.data, function (res) {
- // that.paySuccess()
- // })
- }
- })
- } else {
- this.$toast(`请选择支付商户`)
- }
- // if (this.canScanCode > 0) return this.$toast(`请等待${this.canScanCode}秒后重试`)
- // mini_env(bool => {
- // /material/salses/get/pay/config
- // this.$api
- // .post('/material/salses/pay', {
- // salesId: this.orderId,
- // ...(() => {
- // if (bool) {
- // return {
- // miniPay: true,
- // openId: this.$store.state.user.miniOpenId
- // }
- // }
- // return {}
- // })()
- // })
- // .then(res => {
- // if (!res.data.isPay) {
- // this.paySuccess()
- // } else {
- // if (bool) {
- // uniWebview.navigateTo({
- // url: `/pages/pay/pay?${Object.entries({
- // ...res.data,
- // payPackage: res.data.payPackage.split('=')[0] || '',
- // payPackageVal: res.data.payPackage.split('=')[1] || ''
- // })
- // .map(item => item.join('='))
- // .join('&')}`
- // })
- // } else {
- // weixinPay(res.data, function (res) {
- // that.paySuccess()
- // })
- // }
- // }
- // })
- // .catch(res => {
- // this.$tips(res.message)
- // })
- // .finally(() => {
- // this.canScanCode = 15
- // let time = setInterval(() => {
- // if (this.canScanCode > 0) {
- // this.canScanCode = this.canScanCode - 1
- // } else {
- // clearInterval(time)
- // }
- // }, 1000)
- // })
- // })
- },
- paySuccess() {
- this.$modal({
- content: '支付成功',
- cancelText: '回到首页',
- confirmText: '查看记录'
- })
- .then(() => {
- this.$navToPage(
- {
- url: `/packageMaterial/pages/stock/buyRecord`
- },
- 'reLaunch'
- )
- })
- .catch(() => {
- this.$navToPage(
- {
- url: `/pages/index/index`
- },
- 'switchTab'
- )
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .card {
- @include zj-card;
- }
- .materials-container {
- padding: 30rpx;
- .title {
- text-align: center;
- margin-top: 30rpx;
- .t1 {
- font-size: 32rpx;
- font-weight: 500;
- }
- .t2 {
- font-size: 40rpx;
- color: $minor-color;
- margin-top: 20rpx;
- text {
- font-size: 56rpx;
- font-weight: 500;
- }
- }
- }
- .id {
- margin-top: 50rpx;
- text {
- color: $sec-font;
- }
- }
- .product {
- background: #f5f5f5;
- border-radius: 12rpx;
- padding: 20rpx;
- margin-top: 20rpx;
- .it {
- display: flex;
- align-items: flex-end;
- margin-bottom: 20rpx;
- .name {
- flex: 1;
- font-size: 28rpx;
- font-weight: 500;
- text {
- color: $sec-font;
- margin-left: 12rpx;
- font-weight: normal;
- }
- }
- .price {
- margin-left: 30rpx;
- font-size: 28rpx;
- font-weight: 500;
- }
- }
- .total {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- margin-top: 30rpx;
- .text {
- font-size: 28rpx;
- color: $sec-font;
- }
- .price {
- font-size: 28rpx;
- color: $minor-color;
- font-weight: 500;
- }
- }
- }
- .row {
- margin-top: 20rpx;
- line-height: 40rpx;
- display: flex;
- font-size: 28rpx;
- text {
- color: $sec-font;
- flex-shrink: 0;
- line-height: 40rpx;
- }
- }
- }
- .pay-container {
- padding: 30rpx;
- .top {
- margin-bottom: 50rpx;
- }
- .item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 20rpx 0;
- .left {
- .iconfont {
- font-size: 40rpx;
- color: $sec-font;
- }
- .text {
- margin-left: 18rpx;
- font-size: 32rpx;
- }
- .active {
- color: $theme-color;
- }
- }
- .right {
- .text {
- margin-left: 18rpx;
- font-size: 32rpx;
- }
- }
- }
- }
- </style>
|