From 1996c104181264c764b99d3ccd4a6999ef9fe0ae Mon Sep 17 00:00:00 2001 From: "DESKTOP-GMUNQ1B\\k" <1154079537@qq.com> Date: Tue, 26 Mar 2024 17:06:27 +0800 Subject: [PATCH] 1 --- pages/order_details/index.vue | 4 +- pages/users/order_confirm/index.vue | 19 ++- pages/users/order_list/index.vue | 237 +++++++++++++++++++--------- utils/util.js | 58 +++++++ 4 files changed, 243 insertions(+), 75 deletions(-) diff --git a/pages/order_details/index.vue b/pages/order_details/index.vue index afff32a..e242780 100644 --- a/pages/order_details/index.vue +++ b/pages/order_details/index.vue @@ -337,9 +337,9 @@ <view class='bnt b-color' @tap='confirmOrder'>确认收货</view> </block> <block v-if="orderInfo.status == 2"> - <view class="bnt cancel" @click="allRefund" + <!-- <view class="bnt cancel" @click="allRefund" v-if="refundNum.length != cartInfo.length && orderInfo.refund_status && orderInfo.refund_switch == 1"> - 批量退款</view> + 批量退款</view> --> <navigator v-if="orderInfo.delivery_type == 1 || orderInfo.delivery_type == 4" class='bnt cancel' hover-class='none' :url="'/pages/users/goods_logistics/index?orderId='+ orderInfo.order_id">查看物流 </navigator> diff --git a/pages/users/order_confirm/index.vue b/pages/users/order_confirm/index.vue index 0bba44e..9316d52 100644 --- a/pages/users/order_confirm/index.vue +++ b/pages/users/order_confirm/index.vue @@ -1841,10 +1841,25 @@ }); }) } - //已设置 输入密码 this.$refs.popups.handleOpen(); - } else { //无须支付密码 + } else if (data.pay_type == 'public') { //无须支付密码 + let that = this; + uni.showModal({ + title: "提示", + content: "您确定要使用对公转账的方式付款吗?", + success(res) { + if (res.confirm) { + that.truePayOrder(data); + } else { + uni.showToast({ + title: "您已取消!", + icon: "none" + }) + } + } + }) + } else { this.truePayOrder(data); } }, diff --git a/pages/users/order_list/index.vue b/pages/users/order_list/index.vue index cee06b3..93cecc7 100644 --- a/pages/users/order_list/index.vue +++ b/pages/users/order_list/index.vue @@ -190,11 +190,17 @@ 共{{item.total_num || 0}}件商品,总金额 <text class='money p-color'>¥{{item.pay_price}}</text> </view> + <view class='bottom acea-row row-right row-middle' v-if="item.pay_type != 10"> <view class='bnt b-color' @click.stop='goPay(item.pay_price,item.group_order_id)'> 立即付款</view> </view> - <view class='bottom acea-row row-right row-middle' v-else> + + <view class='bottom acea-row row-right row-middle' v-if="item.pay_type == 10"> + <view class='bnt b-color' + style="background-color: #fff;color: #40ae36;border: 2rpx solid #40ae36;" + @click.stop='handleCopyAccount(item)'> + 收款账户</view> <view class='bnt b-color' @click.stop='uploadEnvidence(item.orderList[0].order_id)'> 上传凭证</view> </view> @@ -316,12 +322,6 @@ <view class='bnt b-color' @tap='confirmOrder(item,index)'>确认收货</view> </block> <block v-if="item.status == 2"> - <!-- <navigator v-if="community_status == 1 && !item.community_id" - :url="'/pages/plantGrass/plant_release/index?order_id='+item.order_id" class='bnt colorBnt' - hover-class="none"> - <text class="iconfont icon-fabu"></text> - 发布种草 - </navigator> --> <view class='bnt b-color' @click='goOrderDetails_Evaluation(item.order_id)'>去评价 </view> </block> @@ -329,12 +329,6 @@ <view class='bnt b-color' @click='goOrderDetails(item.order_id)' v-if="item.activity_type == 2 || item.activity_type == 3 || item.activity_type == 10"> 查看详情</view> - <!-- <navigator v-if="community_status == 1 && !item.community_id" - :url="'/pages/plantGrass/plant_release/index?order_id='+item.order_id" class='bnt colorBnt' - hover-class="none"> - <text class="iconfont icon-fabu"></text> - 发布种草 - </navigator> --> <view class='bnt b-color' @click='goOrderDetails(item.order_id)' v-else>再次购买</view> </block> </view> @@ -353,9 +347,78 @@ <payment :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :order_id="pay_order_id" :totalPrice='totalPrice'></payment> <addInvoicing ref="addInvoicing" @changeInvoiceClose="changeInvoiceClose" :invoice='invoice'></addInvoicing> + + <!-- 用户复制对公账户信息 --> + <uni-popup mode="center" ref="popup"> + <view class="popups"> + <view class="popups-item"> + <view class="popups-item-label">公司名称</view> + <view class="popups-item-val">{{bankInfo.company_name}}</view> + </view> + <view class="popups-item"> + <view class="popups-item-label">对公账户</view> + <view class="popups-item-val">{{bankInfo.corporate_account}}</view> + </view> + <view class="popups-item"> + <view class="popups-item-label">开户行</view> + <view class="popups-item-val">{{bankInfo.corporate_bank}}</view> + </view> + <view class="popups-item"> + <view class="popups-item-label">开户行地址</view> + <view class="popups-item-val">{{bankInfo.corporate_bank_address}}</view> + </view> + + <view class="popups-btn"> + <!-- #ifndef H5 --> + <text class='copy' style="display: block;" @click='handleCopy'>复制</text> + <!-- #endif --> + + <!-- #ifdef H5 --> + <text class='copy-data' style="display: block;" :data-clipboard-text="h5Copy">复制</text> + <!-- #endif --> + </view> + </view> + </uni-popup> </view> </template> +<style lang="scss"> + .popups { + width: 600rpx; + background-color: #fff; + border-radius: 18rpx; + padding: 30rpx; + .popups-btn { + padding: 16rpx 20rpx; + background-color: #40AE36; + color: #fff; + font-size: 28rpx; + text-align: center; + border-radius: 10rpx; + margin-top: 20rpx; + } + + .popups-item { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 30rpx; + + .popups-item-label { + width: 240rpx; + font-size: 28rpx; + color: #282828; + } + + .popups-item-val { + color: #868686; + display: flex; + flex-wrap: nowrap; + justify-content: flex-end; + } + } + } +</style> <script> // +---------------------------------------------------------------------- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ] @@ -400,6 +463,7 @@ import { toLogin } from '@/libs/login.js'; + import ClipboardJS from "@/plugin/clipboard/clipboard.js"; export default { components: { payment, @@ -409,6 +473,8 @@ }, data() { return { + h5Copy: '', + bankInfo: {}, sale_type: 1, //1-普通商品,2-批发商品 loading: false, //是否加载中 loadend: false, //是否加载完毕 @@ -422,43 +488,43 @@ limit: 20, domain: HTTP_REQUEST_URL, payMode: [{ - name: "微信支付", - icon: "icon-weixinzhifu", - value: 'wechat', - title: '微信快捷支付', - payStatus: 1 - }, { - name: "支付宝支付", - icon: "icon-zhifubao", - value: 'alipay', - title: '支付宝支付', - payStatus: this.$store.getters.globalData.alipay_open - }, - { - name: "余额支付", - icon: "icon-yuezhifu", - value: 'balance', - title: '可用余额:', - number: 0, - payStatus: this.$store.getters.globalData.yue_pay_status - }, - { - name: "商户余额", - icon: "icon-yue2", - value: 'merBalance', - title: '可用余额:', - number: 0, - payStatus: 2 - }, - // { - // name: "对公转账", - // icon: "icon-yinhangqia", - // value: 'public', - // title: '对公转账:', - // number: 0, - // payStatus: this.$store.getters.globalData.yue_pay_status - // }, - ], + name: "微信支付", + icon: "icon-weixinzhifu", + value: 'wechat', + title: '微信快捷支付', + payStatus: 1 + }, { + name: "支付宝支付", + icon: "icon-zhifubao", + value: 'alipay', + title: '支付宝支付', + payStatus: this.$store.getters.globalData.alipay_open + }, + { + name: "余额支付", + icon: "icon-yuezhifu", + value: 'balance', + title: '可用余额:', + number: 0, + payStatus: this.$store.getters.globalData.yue_pay_status + }, + { + name: "商户余额", + icon: "icon-yue2", + value: 'merBalance', + title: '可用余额:', + number: 0, + payStatus: 2 + }, + // { + // name: "对公转账", + // icon: "icon-yinhangqia", + // value: 'public', + // title: '对公转账:', + // number: 0, + // payStatus: this.$store.getters.globalData.yue_pay_status + // }, + ], pay_close: false, pay_order_id: '', invoice_order_id: '', @@ -475,15 +541,13 @@ ...mapGetters(['isLogin', 'viewColor']), ...configMap(['hide_mer_status', 'community_status']), }, - watch: { + onLoad(options) { + if (options.sale_type) this.sale_type = options.sale_type; + if (options.status) this.orderStatus = options.status; + let user = this.$store.state.app.userInfo; + if (user.mer_info) this.initMerInfo(user); }, - onLoad(options) { - if(options.sale_type) this.sale_type = options.sale_type; - if(options.status) this.orderStatus = options.status; - let user = this.$store.state.app.userInfo; - if(user.mer_info) this.initMerInfo(user); - }, onShow() { if (this.isLogin) { this.page = 1; @@ -497,9 +561,40 @@ toLogin() } }, - onReady() {}, - mounted: function() {}, + onReady: function() { + // #ifdef H5 + this.$nextTick(() => { + const clipboard = new ClipboardJS(".copy-data"); + clipboard.on("success", () => { + this.$util.Tips({ + title: '复制成功' + }, () => { + this.$refs.popup.close(); + }); + }); + }); + // #endif + }, methods: { + // 赋值银行信息 + handleCopy() { + let that = this; + uni.setClipboardData({ + data: this.h5Copy, + success() { + that.$refs.popup.close(); + } + }); + }, + + // 收款账户 + handleCopyAccount(e) { + this.bankInfo = e.orderList[0].order_extend.bank_info; + this.h5Copy = + `${this.bankInfo.company_name} ${this.bankInfo.corporate_account} ${this.bankInfo.corporate_bank} ${this.bankInfo.corporate_bank_address}`; + this.$refs.popup.open(); + }, + // 购物车 toGwc() { uni.switchTab({ @@ -509,17 +604,17 @@ navBack() { uni.navigateBack(); }, - initMerInfo(user){ - this.mer_info = user; - if(this.mer_info.mer_settlement_agree_status){ - this.payMode.forEach(item=>{ - if(item.value=='merBalance') { - item.payStatus = 1; - item.number = this.mer_info.mer_money; - } - }) - } - }, + initMerInfo(user) { + this.mer_info = user; + if (this.mer_info.mer_settlement_agree_status) { + this.payMode.forEach(item => { + if (item.value == 'merBalance') { + item.payStatus = 1; + item.number = this.mer_info.mer_money; + } + }) + } + }, changeSaleType(type = 1) { if (type != this.sale_type) { this.sale_type = type; @@ -558,7 +653,7 @@ let that = this; getUserInfo().then(res => { that.payMode[2].number = res.data.now_money; - if(res.data.mer_info) that.initMerInfo(res.data.mer_info); + if (res.data.mer_info) that.initMerInfo(res.data.mer_info); }); }, /** diff --git a/utils/util.js b/utils/util.js index 9414227..ccb5068 100644 --- a/utils/util.js +++ b/utils/util.js @@ -24,6 +24,64 @@ import permision from "./permission.js" // #endif export default { + //复制 + uniCopy: ({ + content, + success, + error + }) => { + if (!content) return error('复制的内容不能为空 !') + content = typeof content === 'string' ? content : content.toString() // 复制内容,必须字符串,数字需要转换为字符串 + /** + * 小程序端 和 app端的复制逻辑 + */ + //#ifndef H5 + uni.setClipboardData({ + data: content, + success: function() { + uni.showToast({ + title: "复制成功!", + icon: "success" + }) + }, + fail: function() { + uni.showToast({ + title: "复制失败!", + icon: "none" + }) + } + }); + //#endif + + /** + * H5端的复制逻辑 + */ + // #ifdef H5 + if (!document.queryCommandSupported('copy')) { //为了兼容有些浏览器 queryCommandSupported 的判断 + // 不支持 + error('浏览器不支持') + } + let textarea = document.createElement("textarea") + textarea.value = content + textarea.readOnly = "readOnly" + document.body.appendChild(textarea) + textarea.select() // 选择对象 + textarea.setSelectionRange(0, content.length) //核心 + let result = document.execCommand("copy") // 执行浏览器复制命令 + if (result) { + uni.showToast({ + title: "复制成功!", + icon: "success" + }) + } else { + uni.showToast({ + title: "复制失败!", + icon: "none" + }) + } + textarea.remove() + // #endif + }, // 是否设置密码 checkPassword: async function(e) { e = e ? e : '';