index.vue 7.3 KB

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