Browse Source

我的页面增加门店二维码

liyuan 3 days ago
parent
commit
28508eaf66
3 changed files with 39 additions and 3 deletions
  1. 8 0
      api/home/store.js
  2. 31 3
      pages/me/index.vue
  3. BIN
      static/images/QR.png

+ 8 - 0
api/home/store.js

@@ -58,3 +58,11 @@ export function storageList(data) {
 	})
 	})
 }
 }
 
 
+
+export function generateQrCode(data) {
+	return http.request({
+		url: '/gubersail-app/corpsDesc/generateQrCode',
+		method: 'GET',
+		data
+	})
+}

+ 31 - 3
pages/me/index.vue

@@ -10,6 +10,9 @@
 				<view style="color:#fff;margin-left: 13rpx;font-size: 30rpx;font-weight: 500;">
 				<view style="color:#fff;margin-left: 13rpx;font-size: 30rpx;font-weight: 500;">
 					{{shopInfo.cname?shopInfo.cname:''}}
 					{{shopInfo.cname?shopInfo.cname:''}}
 				</view>
 				</view>
+        <view style="width: 30px; height: 30px; margin-left: auto; margin-right: 13rpx;">
+          <image class="QR" src="@/static/images/QR.png" @click.stop="inQR" style="width: 30px; height: 30px;" />
+        </view>
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="card" style="height: 114rpx;">
 		<view class="card" style="height: 114rpx;">
@@ -132,12 +135,16 @@
 		<!-- 提取去登录 -->
 		<!-- 提取去登录 -->
 		<u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
 		<u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
 			@cancel="adminCancel"></u-modal>
 			@cancel="adminCancel"></u-modal>
+    <uni-popup ref="popup">
+      <image style="width: 400rpx;height: 400rpx;background-color: #fff;" :src="imgPopup" />
+    </uni-popup>
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
 	import {
 	import {
-		getAppDetails
+		getAppDetails,
+    generateQrCode
 	} from '@/api/home/store.js'
 	} from '@/api/home/store.js'
 	export default {
 	export default {
 		data() {
 		data() {
@@ -148,7 +155,8 @@
 				badgeList: [],
 				badgeList: [],
 				form: {},
 				form: {},
 				adminShow: false,
 				adminShow: false,
-				shopInfo: {}
+				shopInfo: {},
+        imgPopup: ''
 			}
 			}
 		},
 		},
 		onShow() {
 		onShow() {
@@ -157,6 +165,26 @@
 			this.getAppDetails()
 			this.getAppDetails()
 		},
 		},
 		methods: {
 		methods: {
+      inQR() {
+        if (this.shopInfo.filePath) {
+          this.imgPopup = this.shopInfo.filePath
+          this.$refs.popup.open()
+          return false
+        }
+        this.imgPopup = null
+        uni.showLoading({
+          title: '加载中',
+          mask: true
+        });
+        generateQrCode({
+          corpId: this.shopInfo.id
+        }).then(res => {
+          this.$refs.popup.open()
+          this.imgPopup = res.data.filePath
+        }).finally(() => {
+              uni.hideLoading()
+        });
+      },
 			getAppDetails() {
 			getAppDetails() {
 				getAppDetails().then(res => {
 				getAppDetails().then(res => {
 					this.shopInfo = res.data
 					this.shopInfo = res.data
@@ -477,4 +505,4 @@
 			color: #797979;
 			color: #797979;
 		}
 		}
 	}
 	}
-</style>
+</style>

BIN
static/images/QR.png