index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <app-layout>
  3. <view class="page">
  4. <view class='scan dir-left-nowrap main-center'>
  5. <view class="icon-box" @click="clerk">
  6. <image v-if='is_not_wechat' :src='clerkImg.un_qr'></image>
  7. <image v-else :src='clerkImg.clerk'></image>
  8. <view class="scan-text">扫码核销</view>
  9. </view>
  10. <!-- #ifndef MP-BAIDU -->
  11. <view class="icon-box" v-if="is_scan_code_pay && is_mall" @click="scan">
  12. <image :src='clerkImg.scan_code_pay'></image>
  13. <view class="scan-text">收款码</view>
  14. </view>
  15. <!-- #endif -->
  16. </view>
  17. <view class='border-css main-center'>
  18. <view></view>
  19. </view>
  20. <view class='main-between list'>
  21. <view class='item box-grow-1' @click="toOrder">
  22. <image src='./../image/order.png'></image>
  23. <view>订单</view>
  24. </view>
  25. <view v-if="is_mall" class='item box-grow-1' @click="toCard">
  26. <image src='./../image/card.png'></image>
  27. <view>卡券</view>
  28. </view>
  29. <view class='item box-grow-1' @click="toStatic">
  30. <image src='./../image/static.png'></image>
  31. <view>核销统计</view>
  32. </view>
  33. </view>
  34. </view>
  35. </app-layout>
  36. </template>
  37. <script>
  38. import * as utils from '../../../core/utils.js';
  39. import { mapState } from "vuex";
  40. export default {
  41. name: "about",
  42. data() {
  43. return {
  44. is_mall: false,
  45. is_scan_code_pay: false,
  46. is_not_wechat: false,
  47. };
  48. },
  49. computed: {
  50. ...mapState({
  51. clerkImg: state => state.mallConfig.__wxapp_img.clerk,
  52. mall: state => state.mallConfig.mall
  53. }),
  54. },
  55. onLoad() { this.$commonLoad.onload();
  56. // #ifdef H5
  57. this.is_not_wechat = !this.$jwx.isWechat();
  58. // #endif
  59. this.getList();
  60. },
  61. methods: {
  62. toStatic() {
  63. uni.navigateTo({
  64. url: '/plugins/clerk/statics/statics'
  65. });
  66. },
  67. toOrder() {
  68. uni.navigateTo({
  69. url: '/plugins/clerk/order/order?status=1'
  70. });
  71. },
  72. toCard() {
  73. uni.navigateTo({
  74. url: '/plugins/clerk/order/order?status=2'
  75. });
  76. },
  77. clerk() {
  78. let that = this;
  79. // #ifndef MP-ALIPAY || H5
  80. uni.scanCode({
  81. success(res) {
  82. if(res.path) {
  83. let path = res.path
  84. path = path.split('?');
  85. let scene = path[1];
  86. let reg = new RegExp("scene=", "g");
  87. scene = path[1].replace(reg, "");
  88. that.$request({
  89. url: that.$api.clerk.qrcode_parameter,
  90. data: {
  91. token: scene
  92. }
  93. }).then(response => {
  94. if (response.code === 0) {
  95. let detail = response.data.detail;
  96. let url = '/' + detail.path;
  97. if (detail.data) {
  98. url += '?' + utils.objectToUrlParams(detail.data);
  99. }
  100. uni.redirectTo({
  101. url: url
  102. })
  103. uni.options = null;
  104. }
  105. });
  106. }else {
  107. uni.showModal({
  108. title: '提示',
  109. content: '暂不支持此二维码,请使用应用内扫一扫功能',
  110. showCancel: false,
  111. icon: 'none',
  112. duration: 1000
  113. });
  114. }
  115. }
  116. })
  117. // #endif
  118. // #ifdef MP-ALIPAY
  119. my.ap.navigateToAlipayPage({
  120. appCode:'alipayScan',
  121. success:(res) => {
  122. },
  123. fail:(res) => {
  124. my.alert({content:'失败:'+JSON.stringify(res)});
  125. }
  126. });
  127. // #endif
  128. // #ifdef H5
  129. if (this.$jwx.isWechat()) {
  130. this.$jwx.scanQRCode({
  131. success(res) {
  132. let path = '';
  133. if(res.path) {
  134. path = res.path;
  135. }
  136. if(res.resultStr) {
  137. let index = res.resultStr.indexOf('?#')
  138. if(index > -1) {
  139. path = res.resultStr.substring(index + 2);
  140. }else {
  141. uni.showToast({
  142. title: res.resultStr,
  143. icon: 'none',
  144. duration: 1000
  145. });
  146. }
  147. }
  148. if(!path) {
  149. uni.showToast({
  150. title: '无法处理的二维码',
  151. icon: 'none',
  152. duration: 1000
  153. });
  154. return false;
  155. }
  156. path = path.split('?');
  157. let scene = path[1];
  158. let reg = new RegExp("scene=", "g");
  159. scene = path[1].replace(reg, "");
  160. that.$request({
  161. url: that.$api.clerk.qrcode_parameter,
  162. data: {
  163. token: scene
  164. }
  165. }).then(response => {
  166. if (response.code === 0) {
  167. let detail = response.data.detail;
  168. let url = '/' + detail.path;
  169. if (detail.data) {
  170. url += '?' + utils.objectToUrlParams(detail.data);
  171. }
  172. uni.navigateTo({
  173. url: url
  174. })
  175. uni.options = null;
  176. }
  177. });
  178. }
  179. })
  180. } else {
  181. uni.showToast({
  182. title: '暂不支持浏览器点击扫码,请应用扫一扫功能',
  183. icon: 'none',
  184. duration: 1000
  185. });
  186. }
  187. // #endif
  188. },
  189. scan() {
  190. uni.redirectTo({
  191. url: '/pages/app_admin/payment-code/payment-code?is_clerk_enter=1'
  192. })
  193. },
  194. getList() {
  195. let that = this;
  196. that.$request({
  197. url: that.$api.clerk.info,
  198. }).then(response=>{
  199. that.$hideLoading();
  200. if(response.code == 0) {
  201. that.is_mall = response.data.is_mall;
  202. that.is_scan_code_pay = response.data.is_clerk;
  203. }else {
  204. if(response.msg == '无核销信息权限') {
  205. uni.showModal({
  206. title: '提示',
  207. content: '该帐号无核销权限',
  208. showCancel: false,
  209. success: function (res) {
  210. uni.redirectTo({
  211. url: '/pages/index/index'
  212. })
  213. }
  214. });
  215. }else {
  216. uni.showToast({
  217. title: response.msg,
  218. icon: 'none',
  219. duration: 1000
  220. });
  221. }
  222. }
  223. }).catch(response => {
  224. that.$hideLoading();
  225. });
  226. },
  227. }
  228. }
  229. </script>
  230. <style scoped lang="scss">
  231. .page {
  232. position: absolute;
  233. top: 0;
  234. left: 0;
  235. height: 100%;
  236. width: 100%;
  237. background-color: #fff;
  238. }
  239. .shop-info {
  240. margin-top: #{88rpx};
  241. color: #666666;
  242. font-size: #{32rpx};
  243. }
  244. .shop-info image {
  245. height: #{40rpx};
  246. width: #{40rpx};
  247. margin-right: #{24rpx};
  248. }
  249. .scan,.scan button {
  250. height: #{380rpx};
  251. width: #{380rpx};
  252. margin: #{150rpx} auto #{72rpx};
  253. color: #fff;
  254. font-size: #{38rpx};
  255. position: relative;
  256. z-index: 10;
  257. }
  258. .scan image {
  259. height: #{276rpx};
  260. width: #{276rpx};
  261. }
  262. .icon-box {
  263. position: relative;
  264. }
  265. .scan-text {
  266. position: absolute;
  267. width: #{276rpx};
  268. text-align: center;
  269. font-size: #{32rpx};
  270. top: #{160rpx};
  271. left: 0;
  272. right: 0;
  273. }
  274. .border-css {
  275. position: absolute;
  276. top: #{-676rpx};
  277. height: #{1500rpx};
  278. width: #{750rpx};
  279. left: 0;
  280. overflow: hidden;
  281. }
  282. .border-css view {
  283. position: absolute;
  284. height: #{1300rpx};
  285. width: #{1300rpx};
  286. border-radius: 50%;
  287. box-shadow: 0 0 #{40rpx} rgb(239, 239, 239);
  288. }
  289. .list {
  290. margin: #{204rpx} auto;
  291. position: relative;
  292. z-index: 100;
  293. width: 100%;
  294. }
  295. .item {
  296. text-align: center;
  297. color: #353535;
  298. font-size: #{28rpx};
  299. }
  300. .item image {
  301. width: #{80rpx};
  302. height: #{80rpx};
  303. margin-bottom: #{24rpx};
  304. }
  305. </style>