Procházet zdrojové kódy

1.添加判断是否为最新版本
2.电影票详情,实际支付价格显示错误

DaMowang před 2 roky
rodič
revize
f0a7df73e6

+ 68 - 6
src/App.vue

@@ -1,11 +1,12 @@
 <script>
+import { showModal, showLoading } from '@/utils/myfun.js';
 export default {
     globalData: {
         shopInfo: {},
         version: ""
     },
     onLaunch() {
-        var logs = uni.getStorageSync("logs") || [];
+        let logs = uni.getStorageSync("logs") || [];
         logs.unshift(Date.now());
         uni.setStorageSync("logs", logs);
         uni.setStorageSync("mallName", "茶付宝");
@@ -15,13 +16,74 @@ export default {
             shop_name: accountInfo.nickname,
             shop_image: accountInfo.icon
         }
-        // #ifdef MP-WEIXIN || MP-QQ
-        const miniProgram  = uni.getAccountInfoSync();
-        this.version = miniProgram.miniProgram.version;
-        // #endif
     },
-    onShow() {},
+    onShow() {
+        this.autoUpdate();
+    },
     onHide() {},
+    methods: {
+        autoUpdate() {
+            // 更新的功能基础库要1.9.90以上版本才支持,要做低版本的兼容处理
+            if (uni.canIUse('getUpdateManager')) {
+                // uni.getUpdateManager接口,可以获知是否有新版本的小程序、新版本是否下载好以及应用新版本的能力,会返回一个UpdateManager实例
+                const updateManager = uni.getUpdateManager();
+                // 检查小程序是否有新版本发布,onCheckForUpdate:当小程序向后台请求完新版本信息,会通知这个版本告知检查结果
+                updateManager.onCheckForUpdate(res => {
+                    // 请求完新版本信息的回调
+                    if (res.hasUpdate) {
+                        // 检测到新版本,需要更新,给出提示
+                        showModal({ content: '检测到新版本,是否下载新版本并重启小程序' }).then(res => {
+                            if (res.confirm) {
+                                this.downLoadAndUpdate(updateManager);
+                            } else if (res.cancel) {
+                                showModal({ content: '本次版本更新涉及到新功能的添加,旧版本将无法正常使用', showCancel: false, confirmText: '确认更新' }).then(res => {
+                                    if (res.confirm) this.downLoadAndUpdate(updateManager);
+                                });
+                            }
+                        });
+                    }
+                });
+            } else {
+                // 在最新版本客户端上体验小程序
+                showModal({ content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试' });
+            }
+        },
+
+        // 下载小程序最新版本并重启
+        downLoadAndUpdate(updateManager) {
+            showLoading({ title: '正在下载' });
+            // 等待下载更新小程序新版本,onUpdateReady:当新版本下载完成回调
+            updateManager.onUpdateReady(() => {
+                uni.hideLoading();
+                // applyUpdate:强制当前小程序应用上新版本并重启
+                updateManager.applyUpdate();
+                // 可在此处添加清除缓存跳转首页操作,由于本人在通过其他判断方式跳转首页,故不再此处跳转
+                // ....
+            });
+            // 当新版本下载失败回调
+            updateManager.onUpdateFailed(() => {
+                uni.hideLoading();
+                // 下载新版本失败
+                showModal({ content: '新版本已经上线了,请删除当前小程序,重新搜索打开' })
+                    .then(() => {
+                        // 点击确定,清空小程序缓存,是小程序情况而定
+                        clearPartStorageSync();
+                        setTimeout(() => {
+                            // 跳转到首页
+                            uni.reLaunch({ url: '/pages/index/index' });
+                        }, 100);
+                    })
+                    .catch(() => {
+                        // 点击取消,同理
+                        clearPartStorageSync();
+                        setTimeout(() => {
+                            uni.reLaunch({ url: '/pages/index/index' });
+                        }, 100);
+                    });
+            });
+        }
+
+    },
 };
 </script>
 <style>

+ 3 - 1
src/main.js

@@ -47,4 +47,6 @@ App.mpType = 'app'
 const app = new Vue({
     ...App
 })
-app.$mount()
+app.$mount()
+
+console.log('版本构建时间:', BUILD_TIME);

+ 6 - 0
src/pages.json

@@ -524,6 +524,12 @@
 					"style": {
 						"navigationBarTitleText": "流水明细"
 					}
+				},
+				{
+					"path": "settledMerchant/merchantDetail",
+					"style": {
+						"navigationBarTitleText": "店铺详情"
+					}
 				}
 			]
 		}

+ 34 - 19
src/pages/cash/index.vue

@@ -6,13 +6,13 @@
             </view>
             <view class="option flex_r flex_ac flex_jb">
                 <view class="balance flex_r flex_ac">
-                    <span>账户{{ islocal?'余额':'云宝' }}:{{ user_money }}</span>
+                    <span>账户余额:{{ user_money }}</span>
                     <span v-if="islocal">可提额度:{{ available_money }}</span>
                 </view>
-                <view class="option_text" @tap="getListPage">提现记录</view>
+                <view class="option_text" @tap="getListPage" v-if="islocal">提现记录</view>
             </view>
         </view>
-        <view class="upload flex_c flex_jc flex_ac">
+        <view class="upload flex_c flex_jc flex_ac" v-if="!isBank">
             <block v-if="imgs == '' || imgs == undefined">
                 <view class="upload_con flex_c flex_ac flex_jc" @tap="uploadImg"><text>+</text></view>
             </block>
@@ -31,7 +31,7 @@ export default {
     data() {
         return {
             show: [],
-            inputMoney: "",
+            inputMoney: undefined,
             imgs: "",
             index: 0,
             userinfo: undefined, // 获取用户信息
@@ -44,7 +44,7 @@ export default {
             islocal: false
         };
     },
-    onLoad: function(e) {
+    onLoad(e) {
         if (e.type == "local") {
             this.getLU();
             this.islocal = true;
@@ -56,29 +56,31 @@ export default {
     },
     methods: {
         getExolain() {
-            let url = this.islocal ? "local/withdrawDesc" : "v1/withdrawdesc"
+            let url = this.islocal ? "local/withdrawDesc" : "v1/merchant/withdrawDesc" // 云宝"v1/withdrawdesc"
             post(url).then(res => {
-                this.show = this.islocal ? res.data[0] : res.data.data[0]
+                this.show = this.islocal ? res.data[0] : res.data
             })
         },
         onSubForm() {
             let that = this;
-            let url = this.islocal ? "local/withdraw" : "v1/user/withdraw"
+            let url = this.islocal ? "local/withdraw" : "v1/merchant/withdraw" // 云宝"v1/user/withdraw"
             if (this.inputMoney == "") {
                 this.$toast("请输入金额");
                 return;
             }
-            if (!this.imgs) {
-                uni.showModal({
-                    content: `请上传您的收款码`,
-                    showCancel: false,
-                    success(res) {},
-                });
-                return;
+            if(!this.isBank){
+                if (!this.imgs) {
+                    uni.showModal({
+                        content: `请上传您的收款码`,
+                        showCancel: false,
+                        success(res) {},
+                    });
+                    return;
+                }
             }
-            if (Number(this.inputMoney) > Number(this.user_money)) {
+            if (Number(this.inputMoney) > Number(this.available_money)) {
                 uni.showModal({
-                    content: `当前可提现${that.user_money}`,
+                    content: `当前可提现${that.available_money}`,
                     showCancel: false,
                     success(res) {},
                 });
@@ -91,6 +93,7 @@ export default {
             let data = {
                 money: this.inputMoney,
                 pay_code: this.imgs,
+                w_code: this.imgs,
                 w_type: 1,
             };
             post(url, data).then((res) => {
@@ -150,8 +153,11 @@ export default {
         },
 
         async getU() {
-            this.userinfo = await uni.userfun();
-            this.user_money = this.userinfo.user_money;
+            // this.userinfo = await uni.userfun();
+            // this.user_money = this.userinfo.user_money;
+            this.localInfo = await uni.Luserfun();
+            this.user_money = this.localInfo.merchant_money;
+            this.available_money = this.user_money
         },
         async getLU() {
             this.localInfo = await uni.Luserfun();
@@ -163,6 +169,15 @@ export default {
             })
         },
     },
+    computed: {
+        isBank() {
+            if(this.islocal) return false
+            else {
+                if(!this.inputMoney) return false
+                else return this.inputMoney > 1000
+            }
+        }
+    },
 };
 </script>
 <style lang="scss" scoped>

+ 3 - 2
src/pagesB/cinema/cinemaTicket.vue

@@ -43,7 +43,7 @@
                 <div class="tit">订单详情</div>
                 <view class="label">
                     <view class="title">实付金额:</view>
-                    <view class="nums">¥{{ order.actually_paid || order.pay_amount }}</view>
+                    <view class="nums">¥{{ $h.Add(order.balance_amount, order.pay_amount) }}</view>
                 </view>
                 <view class="label">
                     <view class="title">订单编号:</view>
@@ -87,7 +87,7 @@
                 </div>
                 <div class="li flex_r flex_jb">
                     <span>实付金额</span>
-                    <span>¥{{ order.actually_paid || order.pay_amount }}</span>
+                    <span>¥{{ $h.Add(order.balance_amount, order.pay_amount) }}</span>
                 </div>
             </div>
             <div class="btnbar" v-if="ispay" @click="pay">立即支付
@@ -139,6 +139,7 @@ export default {
                             seatInfos: arr.map(item => item.seatName).join(","),
                             pay_amount: da.pay_amount,
                             order_amount: da.order_amount,
+                            balance_amount: da.balance_amount,
                             create_time: da.create_time,
                             status: da.status
                         }

+ 4 - 1
src/pagesB/my/shuZhiWallet.vue

@@ -28,7 +28,10 @@
             <div class="li" v-for="(i,s) in List" :key="s">
                 <p class="flex_r flex_jb">
                     <span class="s1">{{ i.remark }}</span>
-                    <span class="s2">{{ parseFloat(i.money).toFixed(2) }}</span>
+                    <span>
+                        {{ i.act }}
+                        <span class="s2">{{ parseFloat(i.money).toFixed(2) }}</span>
+                    </span>
                 </p>
                 <p class="flex_r flex_jb">
                     <span class="s3">{{ i.create_time }}</span>

+ 4 - 9
src/pagesC/settledMerchant/merchant.vue

@@ -50,10 +50,7 @@ export default {
     data() {
         return {
             query: {},
-            merchantID: "",
-            merchantInfo: {
-                distance:0
-            },
+            shopID: "",
             detail: {},
             config: {
                 title: "",
@@ -75,7 +72,7 @@ export default {
         async merchant(){
             let adres = await uni.Location();
             post("v1/merchant/detail", {
-                merchant_id: this.merchantID,
+                shop_id: this.shopID,
                 longitude: adres.lng,
                 latitude: adres.lat
             }).then((res) => {
@@ -169,14 +166,12 @@ export default {
         console.log("参数:", da);
         if(da.scene) da = this.sceneToObject(da.scene);
         console.log("参数:", da);
-        this.merchantID = da.id;
+        this.shopID = da.id;
         let token = uni.getStorageSync("token");
         if (!token) this.login();
         else this.merchant();
     },
-    onShow() {
-        this.merchantInfo = this.getLS("merchant")
-    },
+    onShow() {},
     mounted() {},
 };
 </script>

+ 123 - 0
src/pagesC/settledMerchant/merchantDetail.vue

@@ -0,0 +1,123 @@
+<template>
+    <div class="merchantDetail">
+        <div class="list-item">
+            <div class="head_info_row flex_r flex_ac flex_jb">
+                <image class="logo" :src="detail.logo" />
+                <div class="head_name">
+                    <div class="name">{{ detail.name }}</div>
+                    <div class="flex_r flex_ac">
+                        <uni-rate :max="5" :value="detail.score" :size="12" allow-half />
+                        <span class="commentScore">{{detail.score}}分</span>
+                    </div>
+                </div>
+                <!-- <div class="twocode iconfont" @click="showcode({id:detail.shop_id,name:detail.name})">&#xe635;</div> -->
+            </div>
+            <div class="p1 flex_r flex_jb flex_ac">
+                <div class="l"><span class="iconfont">&#xe9d2;</span>业务员:{{detail.nickname}}</div>
+                <div class="r" @click="copyText(detail.mobile)"><span class="iconfont">&#xe9d3;</span>电话:{{detail.mobile}}<span class="iconfont copy">&#xe602;</span></div>
+            </div>
+            <div class="p1 flex_r flex_jb flex_ac" v-if="detail.user_nickname">
+                <div class="l"><span class="iconfont">&#xe9b9;</span>区域商:{{detail.user_nickname}}</div>
+                <div class="r" @click="copyText(detail.user_mobile)"><span class="iconfont">&#xe9d3;</span>电话:{{detail.user_mobile}}<span class="iconfont copy">&#xe602;</span></div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+import { post } from "@/request/api.js";
+import uniCopy from "@/utils/copy";
+export default {
+    name: "merchantDetail",
+    props: {},
+    components: {},
+    data() {
+        return {
+            shopID: "",
+            detail: {},
+        };
+    },
+    methods: {
+        loadData(){
+            post("v1/merchant/detail", { shop_id: this.shopID }).then((res) => {
+                if (res.code == 0) {
+                    let da = res.data;
+                    if(da.atlas) da.atlas = JSON.parse(da.atlas)
+                    else da.atlas = []
+                    this.detail = da
+                }
+            });
+        },
+        // 复制账号
+        copyText(e) {
+            uniCopy({
+                content: e,
+                success: (res) => {},
+                error: (e) => {},
+            });
+        },
+    },
+    onLoad(da) {
+        this.shopID = da.id;
+        this.loadData();
+    },
+    onShow() {},
+    mounted() {},
+};
+</script>
+
+<style scoped lang='scss'>
+.merchantDetail{
+    padding: 28rpx 32rpx;
+}
+.list-item {
+    margin-bottom: 50rpx;
+    border-radius: 16rpx;
+    padding: 28rpx 32rpx;
+    border: 2rpx solid rgba(0, 0, 0, 0.12);
+    box-shadow: 4rpx 4rpx 8rpx 4rpx rgba(0, 0, 0, 0.12);
+    .head_info_row {
+        .logo {
+            width: 120rpx;
+            height: 110rpx;
+            border-radius: 12rpx;
+            margin-right: 25rpx;
+            border: 1px solid #e5e5e5;
+        }
+
+        .head_name {
+            width: calc(100% - 220rpx);
+
+            .name {
+                font-size: 36rpx;
+                font-weight: 600;
+                margin-bottom: 12rpx;
+            }
+
+            .commentScore {
+                margin-left: 10rpx;
+                font-size: 24rpx;
+            }
+        }
+
+        .twocode {
+            font-size: 60rpx;
+        }
+    }
+
+    .p1 {
+        font-size: 26rpx;
+        margin-top: 20rpx;
+
+        .iconfont {
+            font-size: 26rpx;
+            color: #2e57fd;
+            margin-right: 10rpx;
+        }
+        .copy {
+            color: #333;
+            margin-left: 6rpx;
+        }
+    }
+}
+</style>

+ 1 - 1
src/pagesC/settledMerchant/myBusiness.vue

@@ -17,7 +17,7 @@
                             <span class="commentScore">{{i.score}}分</span>
                         </div>
                     </div>
-                    <div class="twocode iconfont" @click="showcode({id:i.merchant_id,name:i.name})">&#xe635;</div>
+                    <div class="twocode iconfont" @click="showcode({id:i.id,name:i.name})">&#xe635;</div>
                 </div>
                 <div class="p1 flex_r">
                     <div>商户姓名:{{i.contact}}</div>

+ 14 - 6
src/pagesC/settledMerchant/myShop.vue

@@ -3,7 +3,7 @@
         <div class="card">
             <div class="money" @click="goto('/pagesC/settledMerchant/balanceLog',{s:0})">¥{{money.withdraw_money || "0.00"}}</div>
             <div class="msg">可提现金额(元)</div>
-            <div class="btn">
+            <div class="btn" @click="getToCash">
                 <span>去提现</span>
                 <span class="iconfont">&#xe62e;</span>
             </div>
@@ -13,7 +13,7 @@
             <div class="day_income" @click="goto('/pagesC/settledMerchant/balanceLog',{s:1})">今日收入<span>¥{{money.day_income || "0.00"}}</span></div>
         </div>
         <div class="list" v-if="list.length">
-            <div class="list-item" v-for="(i,s) in list" :key="s">
+            <div class="list-item" v-for="(i,s) in list" :key="s" @click="goDetail(i.shop_id)">
                 <div class="head_info_row flex_r flex_ac flex_jb">
                     <image class="logo" :src="i.logo" />
                     <div class="head_name">
@@ -23,15 +23,15 @@
                             <span class="commentScore">{{i.score}}分</span>
                         </div>
                     </div>
-                    <div class="twocode iconfont" @click="showcode({id:i.merchant_id,name:i.name})">&#xe635;</div>
+                    <div class="twocode iconfont" @click.stop="showcode({id:i.shop_id,name:i.name})">&#xe635;</div>
                 </div>
                 <div class="p1 flex_r flex_jb flex_ac">
                     <div class="l"><span class="iconfont">&#xe9d2;</span>业务员:{{i.nickname}}</div>
-                    <div class="r" @click="copyText(i.mobile)"><span class="iconfont">&#xe9d3;</span>电话:{{i.mobile}}<span class="iconfont copy">&#xe602;</span></div>
+                    <div class="r" @click.stop="copyText(i.mobile)"><span class="iconfont">&#xe9d3;</span>电话:{{i.mobile}}<span class="iconfont copy">&#xe602;</span></div>
                 </div>
                 <div class="p1 flex_r flex_jb flex_ac" v-if="i.user_nickname">
                     <div class="l"><span class="iconfont">&#xe9b9;</span>区域商:{{i.user_nickname}}</div>
-                    <div class="r" @click="copyText(i.user_mobile)"><span class="iconfont">&#xe9d3;</span>电话:{{i.user_mobile}}<span class="iconfont copy">&#xe602;</span></div>
+                    <div class="r" @click.stop="copyText(i.user_mobile)"><span class="iconfont">&#xe9d3;</span>电话:{{i.user_mobile}}<span class="iconfont copy">&#xe602;</span></div>
                 </div>
             </div>
         </div>
@@ -66,8 +66,16 @@ export default {
                 }
             })
         },
+        // 跳转到提现页面
+        getToCash(type) {
+            this.goto("/pages/cash/index", { type })
+        },
+        // 跳转到店铺详情
+        goDetail(id) {
+            // this.goto("/pagesC/settledMerchant/merchantDetail", { id })
+        },
         showcode(da) {
-            this.$refs.createCode.showCanvas(da)
+            if(da.id) this.$refs.createCode.showCanvas(da)
         },
         // 复制账号
         copyText(e) {

+ 2 - 2
src/request/config.js

@@ -15,6 +15,6 @@ if (process.env.UNI_PLATFORM === "h5") {
 export default apis == 1 ? {
 	Hhost: "https://shop-api.haocha13.cn/",
 } : {
-	// Hhost: "https://shop-api.haocha13.cn/",  //正式接口
-	Hhost: "https://test-api.haocha13.cn/",
+	Hhost: "https://shop-api.haocha13.cn/",  //正式接口
+	// Hhost: "https://test-api.haocha13.cn/",
 }

+ 25 - 1
src/utils/myfun.js

@@ -165,4 +165,28 @@ export function toast(msg, duration) {
         icon: "none",
         duration: duration ? duration : 1500,
     });
-}
+}
+
+export const showModal = ({ content, showCancel = true, confirmText = '确定' }) => {
+	return new Promise((resolve, reject) => {
+		uni.showModal({
+			title: '提示',
+			content: content,
+			showCancel,
+			confirmText,
+			success: (res) => {
+				resolve(res)
+			},
+			fail: (err) => {
+				reject(err)
+			}
+		})
+	})
+}
+
+export const showLoading = ({ title }) => {
+	return uni.showLoading({
+		title,
+		mask: true
+	})
+}

+ 12 - 0
src/utils/share.js

@@ -21,6 +21,18 @@ export default {
 		}
 	},
     onLoad(da){
+        if(da.scene) da = sceneToObject(da.scene);
         if(da.invite) uni.setStorageSync("inviteCode", da.invite);
     }
+}
+let sceneToObject = (scene) => {
+	scene = decodeURIComponent(scene);
+	let ret = {}
+	let regParam = /([^&=]+)=([\w\W]*?)(&|$|#)/g
+	let strParam = scene;
+	let result
+	while ((result = regParam.exec(strParam)) != null) {
+		ret[result[1]] = result[2]
+	}
+	return ret;
 }

+ 11 - 2
vue.config.js

@@ -1,4 +1,13 @@
+const dayjs = require('dayjs');
+const webpack = require('webpack');
 module.exports = {
-    transpileDependencies: ['@dcloudio/uni-ui']
-    // transpileDependencies: ['uview-ui']
+    // transpileDependencies: ['uview-ui'],
+    transpileDependencies: ['@dcloudio/uni-ui'],
+    configureWebpack: {
+        plugins: [
+            new webpack.DefinePlugin({
+                'BUILD_TIME': JSON.stringify(dayjs().format('YYYY-MM-DD HH:mm:ss'))
+            })
+        ]
+    },
 }