【类 型】: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;">
<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" /> -->
</view>
<!-- 站长推荐 -->

View File

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

View File

@ -111,7 +111,7 @@
</u-popup>
<!-- 按钮 -->
<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 class="numberBut fci rad8 fz28 fb flex mac mc m-l-24" @click="handleSubmit"
@ -126,7 +126,8 @@
import {
parseTime,
formatPrice,
truncate
truncate,
callPhone
} from '@/utils/index.js'
export default {
data() {
@ -150,6 +151,7 @@
this.requestRefund_price = this.fullPrice //退
},
methods: {
callPhone, //
formatPrice, //
handledrRefund_priceShow() {
if (!this.requestRefund_price) {

View File

@ -292,3 +292,42 @@ 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)
}
})
}