index.vue 6.6 KB

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