【类 型】:feat

【原  因】:客服功能 拨打电话
【过  程】:调用微信提供的拨打电话接口 从后台获取客服的电话参数
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
air 2025-01-16 14:14:10 +08:00
parent ae63df0591
commit 747ee9226f
4 changed files with 68 additions and 18 deletions

View File

@ -29,7 +29,7 @@
<!-- 主按钮 --> <!-- 主按钮 -->
<view class="flex mse" style="margin-top: 30rpx;"> <view class="flex mse" style="margin-top: 30rpx;">
<mainBut url="/pages/shop/list" bg="#D43030" imgSrc="/static/icons/ordernow.svg" butBt="开始点餐" butSt="Order Now" /> <mainBut url="/pages/shop/list" bg="#D43030" imgSrc="/static/icons/ordernow.svg" butBt="开始点餐" butSt="Order Now" />
<mainBut url="/pages/order/index" bg="#FF8D1A" imgSrc="/static/icons/buggoods.svg" butBt="购买商品" butSt="Buy Goods" /> <mainBut url="/pages/shop/list" bg="#FF8D1A" imgSrc="/static/icons/buggoods.svg" butBt="购买商品" butSt="Buy Goods" />
<!-- <mainBut bg="#FFC300" imgSrc="/static/icons/franchise.svg" butBt="项目介绍" butSt="Introduction" /> --> <!-- <mainBut bg="#FFC300" imgSrc="/static/icons/franchise.svg" butBt="项目介绍" butSt="Introduction" /> -->
</view> </view>
<!-- 站长推荐 --> <!-- 站长推荐 -->

View File

@ -30,7 +30,7 @@
<u-icon name="map-fill" size="28"></u-icon> <u-icon name="map-fill" size="28"></u-icon>
<view class="fz24">地图</view> <view class="fz24">地图</view>
</view> </view>
<view class="setItemBox flex mac column p-24"> <view class="setItemBox flex mac column p-24" @click="callPhone(shopCon.tel)">
<u-icon name="server-fill" size="28"></u-icon> <u-icon name="server-fill" size="28"></u-icon>
<view class="fz24">客服</view> <view class="fz24">客服</view>
</view> </view>
@ -48,6 +48,9 @@
</template> </template>
<script> <script>
import {
callPhone
} from '@/utils/index.js'
export default { export default {
data() { data() {
return { return {
@ -59,13 +62,19 @@
// tabber // tabber
this.$store.commit('setTabbarCurrent', 2) this.$store.commit('setTabbarCurrent', 2)
}, },
methods: {
callPhone,
},
computed: { computed: {
userInfo() { userInfo() {
return this.$store.state.userInfo return this.$store.state.userInfo
} },
//
shopCon() {
return this.$store.state.shopCon
},
}, },
watch: {}, watch: {}
methods: {}
} }
</script> </script>
@ -74,9 +83,9 @@
margin-top: 89rpx; margin-top: 89rpx;
border: 12rpx solid #fff; border: 12rpx solid #fff;
} }
.setItemBox { .setItemBox {
width: 72rpx; width: 72rpx;
height: 72rpx; height: 72rpx;
} }
</style> </style>

View File

@ -111,7 +111,7 @@
</u-popup> </u-popup>
<!-- 按钮 --> <!-- 按钮 -->
<view class="m-l-24 m-r-24 m-t-24 flex mr"> <view class="m-l-24 m-r-24 m-t-24 flex mr">
<view class="nullBut border fcb rad8 fz28 flex mac mc"> <view class="nullBut border fcb rad8 fz28 flex mac mc" @click="callPhone(shopCon.tel)">
联系客服 联系客服
</view> </view>
<view class="numberBut fci rad8 fz28 fb flex mac mc m-l-24" @click="handleSubmit" <view class="numberBut fci rad8 fz28 fb flex mac mc m-l-24" @click="handleSubmit"
@ -126,7 +126,8 @@
import { import {
parseTime, parseTime,
formatPrice, formatPrice,
truncate truncate,
callPhone
} from '@/utils/index.js' } from '@/utils/index.js'
export default { export default {
data() { data() {
@ -140,7 +141,7 @@
currentRemark: -1, // 退 currentRemark: -1, // 退
refund_remarkValue: '', // 退 refund_remarkValue: '', // 退
txtmaxlength: 30, //退 txtmaxlength: 30, //退
isPressed: false, // isPressed: false, //
} }
@ -150,6 +151,7 @@
this.requestRefund_price = this.fullPrice //退 this.requestRefund_price = this.fullPrice //退
}, },
methods: { methods: {
callPhone, //
formatPrice, // formatPrice, //
handledrRefund_priceShow() { handledrRefund_priceShow() {
if (!this.requestRefund_price) { if (!this.requestRefund_price) {
@ -170,7 +172,7 @@
onRefundPriceBlur() { onRefundPriceBlur() {
// 使 formatPrice // 使 formatPrice
this.requestRefund_price = this.formatPrice(this.requestRefund_price) this.requestRefund_price = this.formatPrice(this.requestRefund_price)
// //
if (Number(this.requestRefund_price) > Number(this.fullPrice)) { if (Number(this.requestRefund_price) > Number(this.fullPrice)) {
this.requestRefund_price = Number(this.fullPrice) this.requestRefund_price = Number(this.fullPrice)
@ -181,11 +183,11 @@
if (this.isPressed) { // if (this.isPressed) { //
return return
} }
this.isPressed = true this.isPressed = true
// //
if(!this.refund_remarkDescription){ if (!this.refund_remarkDescription) {
uni.showToast({ uni.showToast({
title: '请填写退款说明', title: '请填写退款说明',
icon: 'error' icon: 'error'
@ -193,7 +195,7 @@
this.isPressed = false this.isPressed = false
return return
} }
if(Number(this.requestRefund_price)===0){ if (Number(this.requestRefund_price) === 0) {
uni.showToast({ uni.showToast({
title: '请填写退款额', title: '请填写退款额',
icon: 'error' icon: 'error'
@ -201,13 +203,13 @@
this.isPressed = false this.isPressed = false
return return
} }
// //
uni.$u.http.post('/Api/Check/refundOrder', { uni.$u.http.post('/Api/Check/refundOrder', {
order_sn:this.order_sn, // order_sn: this.order_sn, //
shop_id: this.$store.state.shop_id, //id shop_id: this.$store.state.shop_id, //id
apply_price:Number(this.requestRefund_price), // apply_price: Number(this.requestRefund_price), //
refund_remark:this.refund_remarkDescription //退 refund_remark: this.refund_remarkDescription //退
}, { }, {
header: { header: {
'Token': this.$store.state.userInfo.token, 'Token': this.$store.state.userInfo.token,

View File

@ -291,4 +291,43 @@ function initMqtt() {
}) //更新订单 }) //更新订单
} }
}) })
}
/**
* 微信接口 拨打电话
* @param {string} tel 电话号码
*/
export function callPhone(tel) {
if (!tel) {
console.error("电话号码为空,无法拨打")
wx.showToast({
title: "电话号码为空",
icon: "none",
duration: 2000
})
return
}
wx.showActionSheet({
itemList: [`拨打电话:${tel}`],
success: () => {
wx.makePhoneCall({
phoneNumber: tel, // 电话号码来源
success: () => {
console.log("拨打电话成功")
wx.showToast({
title: "电话拨打完成",
icon: "success",
duration: 2000
})
},
fail: (err) => {
console.error("拨打电话失败", err)
}
})
},
fail: (err) => {
console.error("用户取消拨打电话", err)
}
})
} }