修复名片订单不跳转半屏小程序问题
修复地图点击进去定位问题
修复少了一个上传的按钮图标
2 files added
11 files modified
251 ■■■■■ changed files
admin/app/api/controller/plus/business/Business.php 2 ●●● patch | view | raw | blame | history
admin/app/api/controller/plus/business/Saving.php 2 ●●● patch | view | raw | blame | history
admin/app/api/model/plus/business/Order.php 2 ●●● patch | view | raw | blame | history
admin/app/common/service/business/Poster.php 13 ●●●● patch | view | raw | blame | history
mobile/pages/plus/business/add.vue 59 ●●●● patch | view | raw | blame | history
mobile/pages/plus/business/detail.vue 77 ●●●●● patch | view | raw | blame | history
mobile/pages/plus/business/index.vue 86 ●●●● patch | view | raw | blame | history
mobile/pages/plus/business/list.vue 6 ●●●● patch | view | raw | blame | history
mobile/static/icon/bddh.png patch | view | raw | blame | history
mobile/static/icon/fenx.png patch | view | raw | blame | history
mobile/static/icon/mrmp.png patch | view | raw | blame | history
shop_vue/src/views/plus/business/template/add.vue 1 ●●●● patch | view | raw | blame | history
shop_vue/src/views/plus/business/template/edit.vue 3 ●●●● patch | view | raw | blame | history
admin/app/api/controller/plus/business/Business.php
@@ -277,7 +277,7 @@
    public function delete()
    {
        $param = request()->param();
        if((new BusinessModel())->get(['business_card_id'=>$param['business_card_id'],'is_default'=>1])){
        if((new BusinessModel())->where(['business_card_id'=>$param['business_card_id'],'is_default'=>1])->find()){
            return $this->renderError('当前名片为默认名片,无法删除,可切换默认名片后进行删除');
        }
        $model = (new BusinessModel())->where('business_card_id', $param['business_card_id'])->find();
admin/app/api/controller/plus/business/Saving.php
@@ -36,7 +36,7 @@
        if((new SavingModel())->add($param)){
            return $this->renderSuccess('');
        }
        return $this->renderError();
        return $this->renderError('');
    }
    
    /**
admin/app/api/model/plus/business/Order.php
@@ -52,7 +52,7 @@
        if ($params['use_balance'] == 1) {
            $payment = $this->onPaymentByBalance($user, $order);
        } elseif ($payType == OrderPayTypeEnum::WECHAT) {
            $this->onPaymentByWechat($user, $order);
            $payment =  $this->onPaymentByWechat($user, $order);
        } else {
            return $this->renderError('支付方式错误');
        }
admin/app/common/service/business/Poster.php
@@ -253,10 +253,17 @@
        imagesavealpha($targetImage, true);
        $bg = imagecolorallocatealpha($targetImage, 255, 255, 255, 127);
        imagefill($targetImage, 0, 0, $bg);
        imagecopyresampled($targetImage, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
        imagecopyresampled($targetImage, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); // 保存时使用最高质量
        $ext = pathinfo($imageUrl, PATHINFO_EXTENSION);
        if ($ext == 'png'){
        imagepng($targetImage, $imageUrl,0); // 根据需要选择合适的函数(如imagepng、imagegif等)
        }else{
            imagejpeg($targetImage, $imageUrl,100);
        }
        // 清理内存
        imagedestroy($targetImage);
        imagedestroy($image);
    }
    /**
@@ -529,7 +536,9 @@
     * @return array
     */
    private function SizeLeftTop($fontSize,$left,$top){
        $data[0] = $fontSize * 0.76;
        // 正确的px到pt转换系数:1px = 0.75pt
        // 使用0.75而不是0.76以确保字体大小显示准确
        $data[0] = $fontSize * 0.75;
        $data[1]  = $left;
        $data[2]  = $top + $fontSize;
        return $data;
mobile/pages/plus/business/add.vue
@@ -89,7 +89,7 @@
                        头像
                    </view>
                    <view class="tx" style="margin-left: 30rpx;">
                        <image class="logo" :src="file_path" mode="heightFix"></image>
                        <image class="logo" :src="file_path||'@/static/shop/login/qietu_1054.png'" mode="heightFix"></image>
                        <Upload v-if="is_avatar" @getImgs="handleAvatarUpload" :imageList="[file_path]"></Upload>
                    </view>
                </view>
@@ -98,7 +98,7 @@
                        logo
                    </view>
                    <view class="logo" style="overflow: hidden;">
                        <image class="logo" :src="logo_path" mode="heightFix"></image>
                        <image class="logo" :src="logo_path||'@/static/shop/login/qietu_1054.png'" mode="heightFix"></image>
                        <Upload v-if="is_logo" @getImgs="handleLogoUpload" :imageList="[logo_path]"></Upload>
                    </view>
                </view>
@@ -117,7 +117,7 @@
                        <view class="lxfx">
                            <view class="lxfxbiaoti"><text style="color: #fa3534;">*</text>手机:</view>
                            <view class="lxfxnrr">
                                <input @input="sjh" placeholder="输入手机号,多个手机号用/隔开" v-model="mobile" class="lxfxneirong"
                                <input @input="sjh" placeholder="输入手机号" v-model="mobile" class="lxfxneirong"
                                    type="text">
                                <input style="display: none;" name="mobile" v-model="business.mobile"
                                    class="lxfxneirong" type="text">
@@ -179,7 +179,7 @@
                            <view class="lxfxbiaoti">所在地区:</view>
                            <view class="lxfxnrr">
                                <input class="lxfxneirong" :value="selectCity" disabled="true"
                                    @click="showMulLinkageThreePicker" placeholder="请选择省市区">
                                    @click="chooseLocation" placeholder="请选择省市区">
                                <input style="display: none;" type="hidden" name="province_id"
                                    v-model="business.province_id">
                                <input style="display: none;" type="hidden" name="city_id" v-model="business.city_id">
@@ -209,6 +209,8 @@
                    <input type="text" style="display: none;" name="logo" :value="logo_id">
                    <input type="text" style="display: none;" name="logo_height" :value="logo_height">
                    <input type="text" style="display: none;" name="logo_width" :value="logo_width">
                    <input type="text" style="display: none;" name="longitude" :value="business.longitude">
                    <input type="text" style="display: none;" name="latitude" :value="business.latitude">
                </view>
                <Popup :show="industryShow" :width="screenWidth" type="bottom" :closeable="true" @close="industryClose">
                    <view class="industry-popup">
@@ -273,7 +275,9 @@
                    city_id: 0, // 城市ID
                    region_id: 0, // 区域ID
                    Introduction: '', // 简介
                    ilk: '' // 名片类型
                    ilk: '' ,// 名片类型
                    latitude:0,
                    longitude:0
                },
                // 名片类型
                ilkList: [], // 类型列表
@@ -284,9 +288,9 @@
                business_card_id: 0, // 名片ID(用于编辑)
                // 图片相关
                file_id: 0, // 头像文件ID
                file_path: "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132", // 头像路径
                file_path: "", // 头像路径
                logo_id: 0, // Logo文件ID
                logo_path: "http://lblmh.com/image/diy/logo_top.png", // Logo路径
                logo_path: "", // Logo路径
                // 布局相关
                unit: [], // 单位信息数组
                logo_height: 0, // Logo高度
@@ -331,6 +335,35 @@
            this.initRegionData();
        },
        methods: {
            // 打开地图选择地址 by lyzflash
            chooseLocation(n) {
                let self=this;
                uni.chooseLocation({
                    success: function (res) {
                        console.log(res);
                        self.business.longitude=res.longitude;
                        self.business.latitude=res.latitude;
                        self.location_address=res.address;
                        self.business.address[0]=res.name;
                        // 获取省市区
                        self.setLocationAddress();
                    }
                });
            },
            // 获取掉省市区 by lyzflash
            setLocationAddress() {
                let self = this;
                self._get('user.address/setLocationAddress', {
                    address: self.location_address
                }, function(res) {
                    /* self.address.location_address = res.data.short_address; */
                    self.business.province_id = res.data.cityCode[0];
                    self.business.city_id = res.data.cityCode[1];
                    self.business.region_id = res.data.cityCode[2];
                    self.selectCity = res.data.region;
                });
            },
            templateClose() {
                this.templateShow = !this.templateShow
            },
@@ -499,8 +532,8 @@
                        })
                        this.file_id = res.data.file_id;
                        this.logo_id = res.data.logo
                        res.data.file_path ? this.file_path = res.data.file_path : "";
                        res.data.logo ? this.logo_path = res.data.logo_image.file_path : "";
                        res.data.file_id ? this.file_path = res.data.file_path : "";
                        res.data.logo ? this.logo_path = res.data.logoImage.file_path : "";
                        res.data.logo_width ? this.logo_width = res.data.logo_width : 0;
                        res.data.logo_height ? this.logo_height = res.data.logo_height : 0;
@@ -666,7 +699,7 @@
    }
    .biaoti {
        color: #37bde6;
        color: #D41003;
        font-size: 40rpx;
        padding: 20rpx 0rpx;
    }
@@ -734,7 +767,7 @@
    .tijiao {
        width: 30%;
        background-color: #37bde6;
        background-color: #D41003;
        margin-left: 35%;
        color: #fff;
    }
@@ -748,7 +781,7 @@
        font-size: 36rpx;
        font-weight: bold;
        margin-bottom: 20rpx;
        color: #37bde6;
        color: #D41003;
    }
    .industry-item {
@@ -758,7 +791,7 @@
    }
    .industry-item.selected {
        color: #37bde6;
        color: #D41003;
    }
    .industry-item:active {
mobile/pages/plus/business/detail.vue
@@ -10,19 +10,19 @@
                <!-- 操作按钮区域 -->
                <view class="action-buttons">
                    <view class="action-btn" @click="makePhoneCall(businessInfo.mobile)">
                        <text class="btn-icon">📞</text>
                        <image src="@/static/icon/bddh.png" class="btn-icon"></image>
                        <text class="btn-text">拨打电话</text>
                    </view>
                    <view class="action-btn" @click="shareToWechat">
                        <text class="btn-icon">💬</text>
                        <image src="@/static/wx.png" class="btn-icon"></image>
                        <text class="btn-text">分享微信</text>
                    </view>
                    <view class="action-btn" @click="openLocation(businessInfo)">
                        <text class="btn-icon">📍</text>
                        <image src="@/static/icon/address_icon.png" class="btn-icon"></image>
                        <text class="btn-text">导航地址</text>
                    </view>
                    <button open-type="share" class="action-btn">
                        <text class="btn-icon">➤</text>
                        <image src="@/static/icon/fenx.png" class="btn-icon"></image>
                        <text class="btn-text">分享名片</text>
                    </button>
                </view>
@@ -115,6 +115,18 @@
                // 预览图片
                uni.previewImage({
                    urls: [_this.businessInfo.mp],
                    longPressActions: {
                        itemList: ['转发给朋友', '保存图片', '收藏', '翻译图片中的文字', '提取文字'],
                        success: function(data) {
                            if (data.tapIndex == 1) {
                                    _this.recordVisit(20)
                                }
                                console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
                        },
                        fail: function(err) {
                            console.log(err.errMsg);
                        }
                    },
                    complete: function(res) {
                        console.log(res);
                    }
@@ -142,11 +154,11 @@
                });
            },
            // 记录访问
            recordVisit() {
            recordVisit(type=10) {
                let _this = this;
                const params = {
                    business_card_id: _this.business_card_id,
                    type: 10
                    type: type
                };
                _this._post('plus.business.saving/add', params, function() {
                    // 无需处理返回结果
@@ -184,45 +196,22 @@
                    this.showError('暂无地址信息');
                    return;
                }
                // 使用腾讯地图API进行地理编码
                const apiKey = 'LS7BZ-NHSWK-CWOJQ-AJC7Y-H5HE2-UGBWR';
                const url = `https://apis.map.qq.com/ws/geocoder/v1/?address=${encodeURIComponent(address)}&key=${apiKey}`;
                uni.request({
                    url: url,
                    success: (res) => {
                        if (res.data.status === 0 && res.data.result) {
                            const location = res.data.result.location;
                console.log( businessInfo.latitude);
                console.log( businessInfo.longitude);
                let latitude=Number(businessInfo.latitude)
                let longitude=Number(businessInfo.longitude)
                            uni.openLocation({
                                latitude: location.lat,
                                longitude: location.lng,
                                name: address,
                    latitude: latitude,
                    longitude: longitude,
                    name: businessInfo.address,
                                address: address,
                                scale: 18
                            });
                        } else {
                            // 地理编码失败,使用默认方式
                            uni.openLocation({
                                latitude: 0,
                                longitude: 0,
                                name: address,
                                address: address,
                                scale: 18
                            });
                    scale: 18,
                    complete: function(res) {
                        console.log(res);
                        }
                    },
                    fail: () => {
                        // 请求失败,使用默认方式
                        uni.openLocation({
                            latitude: 0,
                            longitude: 0,
                            name: address,
                            address: address,
                            scale: 18
                        });
                    }
                });
            },
            // 分享名片
            shareCard() {
@@ -442,6 +431,8 @@
            .btn-icon {
                font-size: 56rpx;
                width: 56rpx;
                height: 56rpx;
                margin-bottom: 12rpx;
            }
@@ -562,7 +553,7 @@
        gap: 10rpx;
        .create-card-btn {
            background: linear-gradient(90deg, #0078d7, #00b4ff);
            background: linear-gradient(90deg, #ff1529, #ff435f);
            color: #fff;
            font-weight: bold;
            padding: 10rpx 0;
@@ -681,7 +672,7 @@
                .confirm-btn {
                    color: #fff;
                    background-color: #37bde6;
                    background-color: #D41003;
                }
            }
        }
mobile/pages/plus/business/index.vue
@@ -59,14 +59,18 @@
                    <text class="close" @click="closePopup">×</text>
                </view>
                <scroll-view scroll-y="true" class="card-scroll">
                    <view class="card-item" v-for="(card, index) in businessList" :key="index"
                        @click="selectCard(index)">
                    <uni-swipe-action>
                        <view v-for="(card, index) in businessList" :key="index">
                            <uni-swipe-action-item :right-options="rightOptions" @click="handleDel(index, card)">
                                <view @click="selectCard(index)" class="card-item">
                        <view :class="{active: card.is_default==1}" class="card-preview">
                            <image style="width: 650rpx;border-radius: 12rpx;" :src="card.mp" mode="widthFix"></image>
                            <image v-show="card.is_default==1" src="@/static/icon/mrmp.png" class="mrmp">
                            </image>
                                        <image v-show="card.is_default==1" src="@/static/icon/mrmp.png" class="mrmp"></image>
                        </view>
                    </view>
                            </uni-swipe-action-item>
                        </view>
                    </uni-swipe-action>
                    <view class="add-card" @click="addNewCard()">
                        <text class="icon iconfont icon-add"></text>
                        <text>添加新名片</text>
@@ -105,9 +109,13 @@
<script>
    import Popup from '@/components/uni-popup.vue';
import uniSwipeAction from '@/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue';
import uniSwipeActionItem from '@/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue';
    export default {
        components: {
            Popup
            Popup,
            uniSwipeAction,
            uniSwipeActionItem
        },
        data() {
            return {
@@ -123,7 +131,13 @@
                showPayment: false, // 显示支付弹窗
                paymentMethod: 'balance', // 支付方式
                topSetting: {}, // 置顶设置
                userInfo: {} // 用户信息
                userInfo: {}, // 用户信息
                rightOptions: [{
                    text: '删除',
                    style: {
                        backgroundColor: '#FF3B30'
                    }
                }]
            };
        },
        onLoad() {
@@ -320,6 +334,54 @@
                } else {
                    return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
                }
            },
            // 删除名片
            handleDel(index, card) {
                // 防止删除默认名片
                if (card.is_default === 1) {
                    this.showToast('默认名片不能删除');
                    return;
                }
                uni.showModal({
                    title: '提示',
                    content: '确定要删除这个名片吗?',
                    success: (res) => {
                        if (res.confirm) {
                            // 调用删除接口
                            this._post('plus.business.business/delete', {
                                business_card_id: card.business_card_id
                            }, (res) => {
                                if (res.code === 1) {
                                    // 删除成功,更新列表
                                    this.businessList.splice(index, 1);
                                    this.showToast('删除成功');
                                    // 如果删除的是当前选中的名片,切换到第一个名片
                                    if (index === this.current) {
                                        if (this.businessList.length > 0) {
                                            this.current = 0;
                                            this.getStatistics(this.businessList[this.current].business_card_id);
                                        }
                                    } else if (index < this.current) {
                                        // 如果删除的是当前选中名片之前的,current减1
                                        this.current--;
                                    }
                                } else {
                                    this.showToast(res.msg || '删除失败');
                                }
                            });
                        }
                    }
                });
            },
            // 显示提示信息
            showToast(msg) {
                uni.showToast({
                    title: msg,
                    icon: 'none',
                    duration: 2000
                });
            }
        },
        onShareAppMessage() {
@@ -412,7 +474,7 @@
                .icon {
                    font-size: 32rpx;
                    color: #37bde6;
                    color: #D41003;
                    margin-right: 16rpx;
                }
@@ -431,7 +493,7 @@
        .btn {
            flex: 1;
            background: #37bde6;
            background: #D41003;
            color: #fff;
            text-align: center;
            padding: 24rpx 0;
@@ -580,7 +642,7 @@
                    &.active {
                        background: #f5f5f5;
                        border: #37bde6 solid 1rpx;
                        border: #D41003 solid 1rpx;
                    }
                    .card-company {
@@ -600,7 +662,7 @@
                align-items: center;
                justify-content: center;
                padding: 30rpx;
                color: #37bde6;
                color: #D41003;
                font-size: 30rpx;
                .icon {
@@ -702,7 +764,7 @@
                        position: relative;
                        &.active {
                            border-color: #37bde6;
                            border-color: #D41003;
                            background: #f0f9ff;
                        }
@@ -732,7 +794,7 @@
                        }
                        .checked {
                            color: #37bde6;
                            color: #D41003;
                            font-size: 36rpx;
                        }
                    }
mobile/pages/plus/business/list.vue
@@ -818,7 +818,7 @@
                    .action-btn {
                        padding: 10rpx 32rpx;
                        background-color: #37bde6;
                        background-color: #D41003;
                        color: #fff;
                        border-radius: 20rpx;
                        font-size: 28rpx;
@@ -932,7 +932,7 @@
                        color: #333;
                        &.active {
                            color: #37bde6;
                            color: #D41003;
                        }
                        .icon-check {
@@ -962,7 +962,7 @@
                    .confirm-btn {
                        color: #fff;
                        background-color: #37bde6;
                        background-color: #D41003;
                    }
                }
            }
mobile/static/icon/bddh.png
mobile/static/icon/fenx.png
mobile/static/icon/mrmp.png

shop_vue/src/views/plus/business/template/add.vue
@@ -860,7 +860,6 @@
                message: '保存成功',
                type: 'success'
              });
              self.$router.push('/plus/business/template/index');
            })
            .catch(error => {
              self.loading = false;
shop_vue/src/views/plus/business/template/edit.vue
@@ -7,7 +7,7 @@
  <div class="user" v-loading="loading">
    <div class="common-form">名片模板编辑</div>
    <div class="poster-box d-s-s">
      <div class="left-box">
      <div class="left-box" style="width: auto;height: auto;">
        <div v-if="form.backdrop" class="img"><img v-img-url="form.backdrop.src" /></div>
        <div class="userinfo">
          <!-- 头像 -->
@@ -881,7 +881,6 @@
                message: '保存成功',
                type: 'success'
              });
              self.$router.push('/plus/business/template/index');
            })
            .catch(error => {
              self.loading = false;