shish 2 лет назад
Родитель
Сommit
1534373155

+ 108 - 0
hdApp/src/admin/ghs/components/keyboard.vue

@@ -0,0 +1,108 @@
+<template>
+	<div class="keyboard">
+		<bottom-popup class="popup-wrap" :show="show" maskBgcolor="none" @close="comfirm" :mask="false">
+			<div class="ui-keyboard">
+				<ul class="ui-keyboard-numbers">
+					<li :class="{'zero': item == 0}" v-for="(item, index) in keyLeftData" :key="index" @click="clickKeyFn(item)">{{ item }}</li>
+				</ul>
+				<ul class="ui-keyboard-btn">
+					<li class="btn-del" @click="del">
+                        <i class="iconfont iconshanchu"></i>
+                    </li>
+					<li class="btn-ok" @click="comfirm">完成</li>
+				</ul>
+			</div>
+		</bottom-popup>
+	</div>
+</template>
+
+<script>
+import BottomPopup from '@/components/plugin/bottom-popup'
+export default {
+	name: 'keyboard',
+	components: {
+		BottomPopup
+	},
+	props: {
+		show: {
+			type: Boolean,
+			default: false
+		}
+	},
+	data() {
+		return {
+			keyLeftData: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.']
+		}
+	},
+	methods: {
+		close() {
+			this.$emit('comfirm')
+		},
+		// 点击数字键盘
+		clickKeyFn(val) {
+			this.$emit('clickKey', val)
+		},
+		// 确认
+		comfirm() {
+			this.$emit('comfirm')
+		},
+		// 删除
+		del() {
+			this.$emit('del')
+		}
+	}
+}
+</script>
+
+<style lang="scss" scoped>
+    .popup-wrap {
+        .ui-keyboard {
+            @include disFlex(center, center);
+            padding: 0 20upx 20upx 20upx;
+            background-color: $backColor;
+            box-shadow: 0 -8upx 16upx #ddd;
+            // 左侧键盘
+            .ui-keyboard-numbers {
+                width: 78%;
+                display: flex;
+                align-items: center;
+                flex-wrap: wrap;
+                li {
+                    width: calc(33.33% - 20upx);
+                }
+                li.zero {
+                    width: calc(66.66% - 20upx);
+                }
+            }
+            // 右侧键盘
+            .ui-keyboard-btn {
+                width: 22%;
+                li {
+                    margin-right: 0;
+                }
+                li.btn-ok {
+                    height: 310upx;
+                    color: #fff;
+                    background-color: $mainColor;
+                    // line-height: 310upx
+                }
+            }
+            li {
+                @include disFlex(center, center);
+                height: 90upx;
+                // line-height: 90upx;
+                text-align: center;
+                border-radius: 10upx;
+                background-color: #fff;
+                margin-top: 20upx;
+                margin-right: 20upx;
+                font-size: 38upx;
+                font-weight: bold;
+                box-shadow: 0 2upx 10upx #ddd;
+            }
+            li:active {
+                background-color: rgba(0, 0, 0, 0.1);
+            }
+        }
+    }
+</style>

+ 136 - 0
hdApp/src/admin/ghs/components/pay-input.vue

@@ -0,0 +1,136 @@
+<template>
+	<div class="pay-module">
+		<div @click="focusFn">
+			<div class="pay-tit">金额(元)</div>
+			<div class="pay-wrap">
+				<span class="money-text">¥</span>
+				<span type="text" class="cashier-text" v-if="val || focus">{{ val }}</span>
+                <span class="cashier-text prompt" v-else>请输入金额</span>
+				<i class="cursor" v-if="focus"></i>
+			</div>
+		</div>
+		<keyboard-module :show="keyShow" @comfirm="hideKeyFn" @clickKey="clickKeyFn" @del="delFn" />
+	</div>
+</template>
+
+<script>
+import keyboardModule from './keyboard'
+export default {
+	name: 'pay-input',
+	components: {
+		keyboardModule
+	},
+	props: {
+		num: {
+			type: String,
+			default: ''
+		},
+		// 输入框动画
+		focus: {
+			type: Boolean,
+			default: false
+		}
+	},
+	data() {
+		return {
+			val: '',
+			keyShow: false
+		}
+	},
+	watch: {
+		num(val) {
+			this.val = val
+		},
+		focus(val) {
+			this.keyShow = val
+		}
+	},
+	methods: {
+		focusFn() {
+			this.$emit('focusFn')
+		},
+		hideKeyFn() {
+			this.$emit('blurFn')
+		},
+		// 点击键盘
+		clickKeyFn(e) {
+			let total = this.val + e
+			this.$emit('clickKey', total)
+		},
+		// 键盘删除
+		delFn() {
+			let total = this.val.substr(0, this.val.length - 1)
+			this.$emit('clickKey', total)
+		}
+	}
+}
+</script>
+
+<style lang="scss" scoped>
+	.pay-module {
+		.pay-tit {
+			margin-bottom: 36upx;
+		}
+		.pay-wrap {
+			@include disFlex(flex-end, flex-start);
+			font-weight: bold;
+			border-bottom: 4upx solid $borderColor;
+			padding-bottom: 38upx;
+			font-family: TextaAlt, serif;
+			height: 70upx;
+			.money-text {
+				font-size: 36upx;
+			}
+			.cashier-text {
+				font-size: 70upx;
+				line-height: 1;
+				margin-left: 8upx;
+                margin-right: 6upx;
+                &.prompt {
+					color: $fontColor3;
+					font-weight: 400;
+					font-size: 50upx;
+                }
+            }
+			.cursor {
+				position: relative;
+				top: 1upx;
+				width: 4upx;
+				height: 100%;
+				background: $mainColor;
+				display: inline-block;
+				-webkit-animation: inputCursorAnimation 1s infinite;
+				-moz-animation: inputCursorAnimation 1s infinite;
+				animation: inputCursorAnimation 1s infinite;
+			}
+		}
+	}
+
+	// 输入框动画
+	@-webkit-keyframes inputCursorAnimation {
+		50% {
+			opacity: 0;
+		}
+		100% {
+			opacity: 1;
+		}
+	}
+
+	@-moz-keyframes inputCursorAnimation {
+		50% {
+			opacity: 0;
+		}
+		100% {
+			opacity: 1;
+		}
+	}
+
+	@keyframes inputCursorAnimation {
+		50% {
+			opacity: 0;
+		}
+		100% {
+			opacity: 1;
+		}
+	}
+</style>

+ 332 - 0
hdApp/src/admin/ghs/pay.vue

@@ -0,0 +1,332 @@
+<template>
+	<div class="app-content pay-wrap">
+		<div class="delivery-wrap">
+			<div class="shop-logo-wrap">
+				<div class="logo-img">
+					<img :src="`${constant.imgUrl}/logo4.png`" alt mode="widthFix" />
+				</div>
+			</div>
+			<div class="module-com pay-input-wrap">
+				<pay-input-module :focus="inpFocus" :num="amount" @focusFn="focusFn" @blurFn="blurFn" @clickKey="clickKeyFn" />
+			</div>
+			<div class="btn-wrap">
+				<!-- #ifdef MP-WEIXIN -->
+				<button class="button-com green" @click="wexinPayFn">微信支付</button>
+				<!-- #endif -->
+				<!-- #ifdef H5 -->
+				<button class="button-com red" @click="aliPayFn">支付宝支付</button>
+				<!-- #endif -->
+			</div>
+		</div>
+	</div>
+</template>
+<script>
+	import { mapGetters } from 'vuex'
+	import PayInputModule from './components/pay-input'
+	import wexinPay from '@/utils/pay/wxPay'
+	import ModalModule from '@/components/plugin/modal'
+	import AppCouponSel from '@/components/app-coupon-sel'
+	import { share } from '@/mixins'
+	import { fastPay } from '@/api/pay'
+	import { recharge } from '@/api/member'
+	import { getOrderShop } from '@/utils/config'
+	export default {
+		name: 'pay',
+		components: {
+			PayInputModule,
+			ModalModule,
+			AppCouponSel
+		},
+		mixins: [share],
+		data() {
+			return {
+				constant: this.$constant,
+				inpFocus: false,
+				amount: '',
+				form: { payWay: 0 },
+				aliPayHtml: '',
+				passwordModal: false,
+				payCallData: null
+			}
+		},
+		computed: {
+			...mapGetters({ orderShop: 'getOrderShop' }),
+			...mapGetters({ shopUser: 'getShopUser' })
+		},
+		onLoad(option) {
+            // #ifdef H5
+			this.specialInit()
+            // #endif
+		},
+		mounted() {},
+		methods: {
+			init(){
+				this.specialInit();
+			},
+			specialInit() {
+				getOrderShop(true).then(res => {
+					this.inpFocus = true
+					// 设置分享
+					let shareParams = {
+						title: `点我付款`, // 分享标题
+						desc: '享随机优惠,最高20元', // 分享内容
+						imgUrl: '',
+						pagePath: `/pages/pay/index?account=${res.shop.id}&store=0&fromType=3`
+					}
+                    // #ifdef MP-WEIXIN
+					this.jweixinFn(shareParams)
+                    // #endif
+					console.log(`/pages/pay/index?account=${res.shop.id}&store=0&fromType=3`)
+				})
+			},
+			toPay() {
+				if (!this.amount) {
+					this.$msg('请先输入金额!')
+					return false
+				}
+				let params = {}
+				params = {
+					prePrice: this.amount,
+					payWay: this.form.payWay,
+				}
+				if (this.option.store) {
+					params.store = this.option.store
+				}
+				params.fromType = this.option.fromType || 1
+				let miniOpenId = uni.getStorageSync('miniOpenId')
+				params.miniOpenId = miniOpenId
+				fastPay(params).then(res => {
+					this.payCallData = res.data
+					//错误返回判断
+					if(res.code == 0){
+						this.$msg(res.msg)
+						return false
+					}
+					if (this.form.payWay == 0) {
+						wexinPay(res.data, this.paySuccess, this.payFail)
+					} else if (this.form.payWay == 1) {
+						window.location.href = res.data.url;
+					} else {
+						this.paySuccess()
+					}
+				})
+			},
+			focusFn() {
+				this.inpFocus = true
+			},
+			// 失焦
+			blurFn() {
+				this.inpFocus = false
+			},
+			// 点击键盘
+			clickKeyFn(val) {
+				this.amount = val
+			},
+			// 支付宝支付
+			aliPayFn() {
+				this.form.payWay = 1
+				this.toPay()
+			},
+			// 微信支付
+			wexinPayFn() {
+				this.form.payWay = 0
+				this.toPay()
+			},
+			// 暂未设置密码
+			hideAlert() {
+				this.$util.pageTo('/pages/user/password')
+			},
+			passwordModalClick(e) {
+				if (e.index === 0) {
+					this.modalCancel()
+				} else {
+					this.toPay()
+				}
+			},
+			modalCancel() {
+				this.passwordModal = false
+			},
+			// 支付成功
+			paySuccess() {
+				this.$util.pageTo({
+					url: '/pages/callback/index',
+					type: 2,
+					query: {
+						pageStatus: 3,
+						orderSn:this.payCallData.orderSn,
+						totalPrice:this.payCallData.totalPrice,
+						id: this.payCallData.orderId,
+						...this.params
+					}
+				})
+			},
+			payFail() {
+			
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.app-content {
+		min-height: calc(100vh - 20upx);
+		padding-top: 20upx;
+	}
+	.tabs-wrap {
+		position: fixed;
+		top: 0;
+		width: 100%;
+		height: 80upx;
+		line-height: 80upx;
+		text-align: center;
+		background-color: #fff;
+		font-size: 30upx;
+		box-shadow: 4upx 4upx 10upx #eee;
+	}
+
+	.pay-wrap {
+		.logo-wrap {
+			padding-top: 70upx;
+			padding-bottom: 60upx;
+			text-align: center;
+			.logo-img {
+				width: 120upx;
+				margin: 0 auto 20upx;
+				border-radius:10upx;
+				img {
+					border-radius: 50%;
+				}
+			}
+		}
+		.pay-input-wrap {
+			background-color: #fff;
+			border-top-left-radius: 20upx;
+			border-top-right-radius: 20upx;
+			padding: 50upx 80upx 28upx;
+			margin-bottom: 0 !important;
+			.balance {
+				margin-top: 30upx;
+				color: $fontColor2;
+			}
+			.btn-wrap {
+				width: 100%;
+				margin-top: 64upx;
+				.button-com {
+					display: block;
+					margin-bottom: 20upx;
+					padding-top: 30upx;
+					padding-bottom: 30upx;
+				}
+			}
+		}
+	}
+
+	// 我要配送
+	.delivery-wrap {
+		.module-com {
+			margin-bottom: 20upx;
+			background-color: #fff;
+			.module-tit {
+				padding: 20upx 18upx;
+				font-size: 28upx;
+				font-weight: 600;
+				border-bottom: 1upx solid $borderColor;
+			}
+			.module-det {
+				padding: 0 30upx;
+			}
+		}
+		// 金额
+		.pay-input-wrap {
+			padding: 50upx 36upx 38upx;
+			.balance {
+				margin-top: 30upx;
+				color: $fontColor2;
+			}
+		}
+		.shop-logo-wrap {
+			padding-bottom: 20upx;
+			@include disFlex(center, center);
+			.logo-img {
+				width: 120upx;
+				border-radius: 10upx;
+				margin: 10upx auto;
+				img {
+					border-radius: 50%;
+				}
+			}
+		}
+		// 可选优惠
+		.discount-wrap {
+			.module-det {
+				padding-top: 20upx;
+				padding-bottom: 20upx;
+			}
+		}
+		// 匿名派送
+		.none-name-delivery {
+			// padding-left: 30upx;
+			padding: 26upx 30upx;
+			// margin-top: 40upx;
+			margin-bottom: 20upx;
+			background-color: #fff;
+			.none-name-text {
+				margin-left: 14upx;
+				color: $fontColor2;
+			}
+		}
+		// 按钮
+		.btn-wrap {
+			width: calc(100% - 60upx);
+			margin: 64upx auto 0;
+			padding-bottom: 20upx;
+			.button-com {
+				display: block;
+				margin-bottom: 20upx;
+				padding-top: 30upx;
+				padding-bottom: 30upx;
+				&:last-child {
+					margin-bottom: 0;
+				}
+			}
+		}
+
+		// 查看更多
+		.view-more {
+			width: auto;
+			padding-bottom: 20upx;
+			margin-bottom: 20upx;
+			font-size: 28upx;
+			@include disFlex(center, center);
+			background-color: #fff;
+			color: #666565;
+			justify-content: flex-start;
+			z-index:9999999;
+			.view-more-text {
+				margin-right: 14upx;
+			}
+			padding-left:40upx;
+			i {
+				font-size: 30upx;
+				font-weight: 600;
+			}
+			.fill-get-man{
+				color:red;
+				margin-left:10upx;
+				font-weight:600;
+				text-decoration:underline;
+			}
+			.pack-up{
+				margin-left:20upx;
+				font-weight:600;
+				color:red;
+				text-decoration:underline;
+			}
+			&.open {
+				i {
+					transform: rotate(180deg);
+				}
+			}
+		}
+	}
+</style>

+ 5 - 0
hdApp/src/admin/home/workbench.vue

@@ -259,6 +259,7 @@
 			<view style="display:flex;width:100vw;padding:20upx 20upx 40upx 20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
 				<view style="width:100vw;margin-top:8upx;"><button @click="balanceChange()">余额变动记录</button></view>
 				<view style="width:100vw;margin-top:8upx;"><button @click="bpSj()">屏蔽此商家</button></view>
+        <view style="width:100vw;margin-top:8upx;"><button @click="recharge()">充值销账</button></view>
 				<view style="width:100vw;margin-top:30upx;"><button @click="closeToShow()">取消</button></view>
 			</view>
 		</uni-popup>
@@ -481,6 +482,10 @@ export default {
         that.confirmPb(that.currentGhs)
 			})
     },
+    recharge(){
+      this.closeToShow()
+      this.pageTo({url: '/admin/ghs/pay?id='+this.currentGhs.id+'&salt='+this.currentGhs.salt})
+    },
     confirmPb(ghs){
       let that = this
       changeDelStatus({delStatus:1,ghsId:ghs.id}).then(res=>{

+ 1 - 0
hdApp/src/pages.json

@@ -166,6 +166,7 @@
 			"root": "admin/ghs",
 			"pages": [
 				{ "path": "shop", "style": {"navigationBarTitleText": "供货商"}},
+				{ "path": "pay", "style": {"navigationBarTitleText": "充值销账"}},
 				{ "path": "addGhs", "style": {"navigationBarTitleText": "添加"}},
 				{ "path": "debtChange", "style": {"navigationBarTitleText": "欠款变动明细"}},
 				{ "path": "balanceChange", "style": {"navigationBarTitleText": "余额变动明细"}}