修改本地生活商家信息

This commit is contained in:
wangxiaowei 2024-08-12 21:06:07 +08:00
parent 12400b4d54
commit 65bc75d7eb
3 changed files with 84 additions and 26 deletions

@ -3,7 +3,7 @@
<view class="confirm-order">
<view class="confirm-con pb-0">
<view class="info bg-white bold">
<view class="name">商家名称</view>
<view class="name">{{info.shopName ? info.shopName : '商家名称'}}</view>
<view class="flex pay">
<view class="m-r-20">¥</view>
<input class="pay-money" v-model="money" type="digit" placeholder="请输入支付金额"
@ -81,9 +81,14 @@
</template>
<script>
import {
strToParams
} from '@/utils/tools'
import {prepay} from '@/api/app'
import {wxpay} from '@/utils/pay'
import {localShopPay, localShopLogin, localShopPayWeixin} from '@/api/user.js'
import {localShopPay, localShopLogin, localShopPayWeixin, localBalance} from '@/api/user.js'
import {getLocalShopById} from "@/api/shop"
export default {
data() {
return {
@ -92,16 +97,24 @@
paywayList: [
{id: 1, icon: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/butie.png', name: '百亿返补', extra: '购买商品参与百亿返补', pay_way: 1},
{id: 2, icon: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/bazhe.png', name: '八折支付', extra: '购买商品享受八折服务', pay_way: 2},
{id: 3, icon: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/icon_withdrawals.png', name: '余额支付', extra: '', pay_way: 3},
],
user_id: 0,
successPopup: false,
cancelPopup: false,
payMoney: 0
payMoney: 0,
lid: 0
};
},
onLoad(options) {
onLoad(query) {
if (query.id) {
this.lid = query.id
} else {
this.lid = strToParams(decodeURIComponent(this.$Router.currentRoute.query.scene)).lid
}
this.login()
this.getLocalShopByIdFunc()
},
methods: {
@ -120,6 +133,14 @@
}
}
},
getLocalShopByIdFunc() {
getLocalShopById({id: this.lid}).then((res) => {
if (res.code == 1) {
this.info = res.data
}
})
},
changePayway(e) {
this.payway = e;
@ -133,6 +154,16 @@
return
}
if (this.money < 1) {
this.$toast({ title: "支付金额需要大于1元" })
return
}
if (!this.$u.test.amount(this.money)) {
this.$toast({ title: "金额格式错误" })
return
}
if (this.user_id <= 0) {
this.$toast({ title: "请重新扫码登录" })
return
@ -143,6 +174,7 @@
deviceId = '0000001'
}
// 银行卡支付
// localShopPay({
// user_id: this.user_id,
@ -161,22 +193,45 @@
// }
// })
if (this.lid === 0) {
this.$toast({ title: "商家ID不存在" })
return false
}
// 余额支付
if (this.payway == 3) {
localBalance({
money: this.money,
lid: this.lid
}).then((result) => {
let status = 'fail'
if (result.code == 1) {
status = 'success'
}
this.handPayResult(status)
})
}
// 微信支付
localShopPayWeixin({
money: this.money
}).then((result) => {
if (result.code == 1) {
const pay = {
nonceStr: result.data.nonceStr,
package: result.data.package,
paySign: result.data.paySign,
signType: result.data.signType,
timeStamp: result.data.timeStamp,
if (this.payway == 1) {
localShopPayWeixin({
money: this.money,
lid: this.lid
}).then((result) => {
if (result.code == 1) {
const pay = {
nonceStr: result.data.nonceStr,
package: result.data.package,
paySign: result.data.paySign,
signType: result.data.signType,
timeStamp: result.data.timeStamp,
}
this.handleWechatPay(pay);
}
console.log('pay=', pay)
this.handleWechatPay(pay);
}
})
})
}
},
// 微信支付
@ -201,6 +256,11 @@
onShowSuccessPopup() {
this.successPopup = !this.successPopup
setTimeout(() => {
uni.switchTab({
url: '/bundle_b/pages/subsidy_shop/subsidy_shop'
})
}, 500)
},
onShowFailPopup() {
@ -228,15 +288,12 @@
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.pay-extra {
color: #6c757d;
font-weight: normal;
}
&:last-child {
margin-top: 40rpx;
}
}
}
}

@ -8,9 +8,9 @@
<view class="shop-menu">
<view class="shop-menu-item" v-for="(item, index) in list" :key="index" @click="goPage(item.lstore_id, item.user_id)">
<view class="flex">
<u-image width="120rpx" height="120rpx" border-radius="50%" :src="item.header_image ? item.header_image : userInfo.avatar"></u-image>
<u-image width="120rpx" height="120rpx" border-radius="50%" :src="item.shopLogo ? item.shopLogo : userInfo.avatar"></u-image>
<view>
<view class="bold lg m-l-10">{{item.store_nickname ? item.store_nickname : userInfo.nickname}}</view>
<view class="bold lg m-l-10">{{item.shopName ? item.shopName : userInfo.nickname}}</view>
</view>
</view>
<view>

@ -2,8 +2,8 @@
<view>
<view class="shop">
<view class="shop-header">
<u-image width="140rpx" height="140rpx" border-radius="50%" :src="info.header_image ? info.header_image : userInfo.avatar" @click="uploadImage"></u-image>
<view @click="this.showNickName = true">{{info.store_nickname ? info.store_nickname : userInfo.nickname}} <u-icon name="edit-pen-fill" color="#999" size="28" class="m-l-10"></u-icon></view>
<u-image width="140rpx" height="140rpx" border-radius="50%" :src="info.shopLogo ? info.shopLogo : userInfo.avatar" @click="uploadImage"></u-image>
<view @click="this.showNickName = true">{{info.shopName ? info.shopName : userInfo.nickname}} <u-icon name="edit-pen-fill" color="#999" size="28" class="m-l-10"></u-icon></view>
</view>
<view class="shop-menu">
<view class="shop-menu-item" v-for="(item, index) in menu" :key="index" @click="goPage(item.src, item.name)">
@ -48,6 +48,7 @@
{title: '商品管理', image: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/local_shop/local_shop.png', src: '/bundle_b/pages/local_shop/local_shop_manager'},
{title: '订单管理', image: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/local_shop/local_order.png', src: '/bundle_b/pages/local_shop/local_shop_order'},
{title: '二维码下载', image: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/local_shop/local_ercode.png', src: '/bundle_b/pages/local_shop/local_ercode'},
{title: '商家账单', image: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/local_shop/local_bill.png', src: '/bundle_b/pages/local_shop/local_bill'},
],
lstore_id: 0,
info: [],