1
0

index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <app-layout>
  3. <view class="page">
  4. <view class='scan'>
  5. <view @click="scan">
  6. <image :src='clerkImg.qr'></image>
  7. <view class='scan-text'>扫码核销</view>
  8. </view>
  9. </view>
  10. <view class='border-css main-center'>
  11. <view></view>
  12. </view>
  13. <view class='main-between list'>
  14. <view class='item box-grow-1' @click="toOrder">
  15. <image src='./../image/order.png'></image>
  16. <view>订单</view>
  17. </view>
  18. <view v-if="is_mall" class='item box-grow-1' @click="toCard">
  19. <image src='./../image/card.png'></image>
  20. <view>卡券</view>
  21. </view>
  22. <view class='item box-grow-1' @click="toStatic">
  23. <image src='./../image/static.png'></image>
  24. <view>核销统计</view>
  25. </view>
  26. </view>
  27. </view>
  28. </app-layout>
  29. </template>
  30. <script>
  31. import * as utils from '../../../core/utils.js';
  32. import { mapState } from "vuex";
  33. export default {
  34. name: "about",
  35. data() {
  36. return {
  37. is_mall: false
  38. };
  39. },
  40. computed: {
  41. ...mapState({
  42. clerkImg: state => state.mallConfig.__wxapp_img.clerk,
  43. mall: state => state.mallConfig.mall
  44. }),
  45. },
  46. onLoad() {
  47. this.getList();
  48. },
  49. methods: {
  50. toStatic() {
  51. uni.navigateTo({
  52. url: '/plugins/clerk/statics/statics'
  53. });
  54. },
  55. toOrder() {
  56. uni.navigateTo({
  57. url: '/plugins/clerk/order/order?status=1'
  58. });
  59. },
  60. toCard() {
  61. uni.navigateTo({
  62. url: '/plugins/clerk/order/order?status=2'
  63. });
  64. },
  65. scan() {
  66. let that = this;
  67. // #ifndef MP-ALIPAY
  68. uni.scanCode({
  69. success(res) {
  70. if(res.path) {
  71. let path = res.path
  72. path = path.split('?');
  73. let scene = path[1];
  74. let reg = new RegExp("scene=", "g");
  75. scene = path[1].replace(reg, "");
  76. that.$request({
  77. url: that.$api.clerk.qrcode_parameter,
  78. data: {
  79. token: scene
  80. }
  81. }).then(response => {
  82. if (response.code === 0) {
  83. let detail = response.data.detail;
  84. let url = '/' + detail.path;
  85. if (detail.data) {
  86. url += '?' + utils.objectToUrlParams(detail.data);
  87. }
  88. uni.redirectTo({
  89. url: url
  90. })
  91. uni.options = null;
  92. }
  93. });
  94. }else {
  95. uni.showToast({
  96. title: '暂不支持此二维码,请使用应用内扫一扫功能',
  97. icon: 'none',
  98. duration: 1000
  99. });
  100. }
  101. }
  102. })
  103. // #endif
  104. // #ifdef MP-ALIPAY
  105. my.ap.navigateToAlipayPage({
  106. appCode:'alipayScan',
  107. success:(res) => {
  108. },
  109. fail:(res) => {
  110. my.alert({content:'失败:'+JSON.stringify(res)});
  111. }
  112. });
  113. // #endif
  114. },
  115. getList() {
  116. let that = this;
  117. that.$request({
  118. url: that.$api.clerk.info,
  119. }).then(response=>{
  120. that.$hideLoading();
  121. if(response.code == 0) {
  122. that.is_mall = response.data.is_mall;
  123. }else {
  124. if(response.msg == '无核销信息权限') {
  125. uni.showModal({
  126. title: '提示',
  127. content: '该帐号无核销权限',
  128. showCancel: false,
  129. success: function (res) {
  130. uni.redirectTo({
  131. url: '/pages/index/index'
  132. })
  133. }
  134. });
  135. }else {
  136. uni.showToast({
  137. title: response.msg,
  138. icon: 'none',
  139. duration: 1000
  140. });
  141. }
  142. }
  143. }).catch(response => {
  144. that.$hideLoading();
  145. });
  146. },
  147. }
  148. }
  149. </script>
  150. <style scoped lang="scss">
  151. .page {
  152. position: absolute;
  153. top: 0;
  154. left: 0;
  155. height: 100%;
  156. width: 100%;
  157. background-color: #fff;
  158. }
  159. .shop-info {
  160. margin-top: #{88rpx};
  161. color: #666666;
  162. font-size: #{32rpx};
  163. }
  164. .shop-info image {
  165. height: #{40rpx};
  166. width: #{40rpx};
  167. margin-right: #{24rpx};
  168. }
  169. .scan,.scan button {
  170. height: #{380rpx};
  171. width: #{380rpx};
  172. margin: #{150rpx} auto #{72rpx};
  173. color: #fff;
  174. font-size: #{38rpx};
  175. position: relative;
  176. z-index: 10;
  177. }
  178. .scan image {
  179. height: #{380rpx};
  180. width: #{380rpx};
  181. }
  182. .scan-text {
  183. position: absolute;
  184. width: #{380rpx};
  185. text-align: center;
  186. top: #{220rpx};
  187. left: 0;
  188. right: 0;
  189. }
  190. .border-css {
  191. position: absolute;
  192. top: #{-676rpx};
  193. height: #{1500rpx};
  194. width: #{750rpx};
  195. left: 0;
  196. overflow: hidden;
  197. }
  198. .border-css view {
  199. position: absolute;
  200. height: #{1300rpx};
  201. width: #{1300rpx};
  202. border-radius: 50%;
  203. box-shadow: 0 0 #{40rpx} rgb(239, 239, 239);
  204. }
  205. .list {
  206. margin: #{204rpx} auto;
  207. position: relative;
  208. z-index: 100;
  209. width: 100%;
  210. }
  211. .item {
  212. text-align: center;
  213. color: #353535;
  214. font-size: #{28rpx};
  215. }
  216. .item image {
  217. width: #{80rpx};
  218. height: #{80rpx};
  219. margin-bottom: #{24rpx};
  220. }
  221. </style>