| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <template>
- <view class="container">
- <!-- 商家信息卡片 -->
- <view class="merchant-card">
- <view class="merchant-info">
- <image class="merchant-logo" :src="merchantInfo.merchantLogo" mode="aspectFill"></image>
- <view class="merchant-detail">
- <view class="merchant-name">{{merchantInfo.merchantName}}</view>
- </view>
- <view class="share-btn" @click="to_share">
- <image src="@/static/images/share.png" mode="aspectFit"></image>
- <text>分享店铺</text>
- </view>
- </view>
- <view class="merchant-phone">
- <image src="@/static/images/phone.png" mode="aspectFit"></image>
- <text>{{ merchantInfo.merchantPhone }}</text>
- </view>
- <!-- 商家描述 -->
- <view class="merchant-desc">
- <text>{{ merchantInfo.merchantDescribe }}</text>
- </view>
- </view>
- <!-- 联系商家部分 -->
- <view class="contact-section">
- <view class="section-title">联系商家</view>
- <!-- 二维码区域 -->
- <view class="qrcode-container">
- <image class="qrcode-img" :src="merchantInfo.merchantCodeUrl" mode="aspectFit"></image>
- <view class="qrcode-tip">扫码添加微信好友</view>
- </view>
- <!-- 客服按钮 -->
- <button class="service-btn" @click="onContactService">在线客服</button>
- </view>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue';
- import { onLoad, onShow, onReachBottom } from "@dcloudio/uni-app";
- import {
- getSbmerchantInfo
- } from "@/api/merchant.js";
- import { toLogin } from "@/libs/login.js";
- import { useAppStore } from "@/stores/app.js";
- const appStore = useAppStore();
- const merchantInfo = ref('')
- const isLogin = appStore.isLogin;
- onLoad((options) => {
- getSbmerchantInfoFn();
- });
- const getSbmerchantInfoFn = () => {
- let data = {
- merchantId:2
- }
- getSbmerchantInfo(data).then((res) => {
- console.log(res);
- merchantInfo.value = res.data;
- })
- }
- // 分享功能
- const onShareAppMessage = () => {
- return {
- title: '水贝珠宝旗舰店',
- path: '/pages/merchant/detail?id=123'
- };
- };
- // 联系客服
- const onContactService = () => {
- // 实际项目中可调用uni.getCustomerServiceManager() API
- uni.showToast({
- title: '正在连接客服...',
- icon: 'loading'
- });
- };
- // 分享店铺
- const to_share = () => {
- if (isLogin) {
- uni.navigateTo({
- url: '/pages/users/share/index?merchantInfo='+encodeURIComponent(JSON.stringify(merchantInfo.value))
- });
- } else {
- toLogin();
- }
- }
- </script>
- <style scoped lang="scss">
- .container {
- padding: 30rpx;
- background-color: #f5f5f5;
- min-height: 100vh;
- box-sizing: border-box;
- }
- /* 头部样式 */
- .header {
- position: sticky;
- top: 0;
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 88rpx;
- padding: 0 32rpx;
- background-color: #fff;
- z-index: 100;
- }
- .back-icon, .more-icon {
- width: 48rpx;
- height: 48rpx;
- display: flex;
- align-items: center;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .title {
- font-size: 36rpx;
- font-weight: bold;
- color: #000;
- }
- /* 商家卡片 */
- .merchant-card {
- padding: 20rpx;
- background-color: #fff;
- border-radius: 24rpx;
- position: relative;
- .merchant-info {
- display: flex;
- align-items: center;
- margin-bottom: 20rpx;
- .merchant-logo {
- width: 160rpx;
- height: 160rpx;
- border-radius: 8rpx;
- margin-right: 30rpx;
- }
- .merchant-detail {
- flex: 1;
- .merchant-name {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 20rpx;
- }
- }
- .share-btn {
- position: absolute;
- top: 30rpx;
- right: 30rpx;
- display: flex;
- align-items: center;
- color: #666;
- font-size: 28rpx;
- image {
- width: 36rpx;
- height: 36rpx;
- margin-right: 10rpx;
- }
- }
- }
- .merchant-phone {
- display: flex;
- align-items: center;
- color: #666;
- font-size: 28rpx;
- margin-bottom: 20rpx;
- image {
- width: 36rpx;
- height: 36rpx;
- margin-right: 10rpx;
- }
- }
- .merchant-desc {
- width: 100%;
- padding: 30rpx;
- font-size: 28rpx;
- color: #333;
- background-color: #f9f9f9;
- border-radius: 20rpx;
- border: 2rpx solid #eee;
- margin-bottom: 20rpx;
- }
- }
- /* 联系商家部分 */
- .contact-section {
- margin-top: 30rpx;
- padding: 40rpx;
- background-color: #fff;
- border-radius: 24rpx;
- .section-title {
- font-size: 36rx;
- font-weight: bold;
- color: #333;
- margin-bottom: 40rpx;
- }
- .qrcode-container {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-bottom: 40rpx;
- .qrcode-img {
- width: 360rpx;
- height: 360rpx;
- }
- .qrcode-tip {
- margin-top: 20rpx;
- font-size: 28rpx;
- color: #666;
- }
- }
- .service-btn {
- width: 100%;
- height: 88rpx;
- line-height: 88rpx;
- background-color: #fff;
- color: #333;
- font-size: 32rpx;
- border: 2rpx solid #ddd;
- border-radius: 8rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- &:after {
- border: none;
- }
- }
- }
- </style>
|