merchant.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view class="body">
  3. <view class="background"></view>
  4. <view class="content">
  5. <view class="userInfo">
  6. <view class="userInfo-box">
  7. <view class="userInfo-img"><image class="portrait" :src="image || '../../static/error/missing-face.png'"></image></view>
  8. <view class="userInfo-xinxi">
  9. <view class="title clamp">
  10. <text>{{ name }}</text>
  11. </view>
  12. <view class="phone">
  13. <text>{{ phone }}</text>
  14. </view>
  15. </view>
  16. <view class="balance clamp">{{ address }}</view>
  17. </view>
  18. </view>
  19. <view class="userInfoList">
  20. <view class="userInfoList-top" @click="sao()">
  21. <view class="top"><image src="../../static/merchant/saoma.png" mode=""></image></view>
  22. 扫码核销
  23. </view>
  24. <view class="userInfoList-top" @click="navTo('/pages/merchant/storeQr')">
  25. <view class="top"><image src="../../static/merchant/erweima.png" mode=""></image></view>
  26. 店铺二维码
  27. </view>
  28. <view class="userInfoList-bottom" @click="navTo('/pages/merchant/finance')">
  29. <view class="bottom"><image src="../../static/merchant/money.png" mode=""></image></view>
  30. 店铺财务
  31. </view>
  32. <view class="userInfoList-bottom" @click="navTo('/pages/merchant/order')">
  33. <view class="bottom"><image src="../../static/merchant/order.png" mode=""></image></view>
  34. 订单管理
  35. </view>
  36. <view class="userInfoList-bottom" @click="navTo('/pages/merchant/commodity')">
  37. <view class="bottom"><image src="../../static/merchant/shop.png" mode=""></image></view>
  38. 商品管理
  39. </view>
  40. <view class="userInfoList-bottom" @click="navTo('/pages/merchant/vipDetail')">
  41. <view class="bottom"><image src="../../static/merchant/vip.png" mode=""></image></view>
  42. 店铺会员
  43. </view>
  44. <view class="userInfoList-bottom" @click="navTo('/pages/merchant/storeData')">
  45. <view class="bottom"><image src="../../static/merchant/dianpu.png" mode=""></image></view>
  46. 店铺数据
  47. </view>
  48. </view>
  49. </view>
  50. <uni-popup ref="popuphx" class="agree-wrapper">
  51. <view class="hx-wrapper">
  52. <view class="hx-img"><image src="../../static/img/hxbg.png" mode=""></image></view>
  53. <view class="hx-body">
  54. <view class="hx-title">输入核销码核销</view>
  55. <input type="text" v-model="code" placeholder="请输入核销码" placeholder-class="hx-placeholder" />
  56. <view class="hx-btn" @click="qhx">立即核销</view>
  57. </view>
  58. <view class="hx-close" @click="close"><image src="../../static/icon/close.png" mode=""></image></view>
  59. </view>
  60. </uni-popup>
  61. </view>
  62. </template>
  63. <script>
  64. import { my, verific } from '@/api/merchant.js';
  65. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  66. export default {
  67. components: {
  68. uniPopup
  69. },
  70. data() {
  71. return {
  72. image: '',
  73. name: '',
  74. phone: '',
  75. address: '',
  76. code: ''
  77. };
  78. },
  79. onLoad() {
  80. my({}).then(({ data }) => {
  81. this.image = data.image;
  82. this.name = data.name;
  83. this.phone = data.phone;
  84. this.address = data.detailed_address;
  85. });
  86. },
  87. methods: {
  88. //跳转
  89. navTo(url) {
  90. uni.navigateTo({
  91. url
  92. });
  93. },
  94. close() {
  95. this.$refs.popuphx.close();
  96. this.code = '';
  97. },
  98. qhx() {
  99. verific({
  100. verify_code: this.code,
  101. is_confirm: 1 //1是核销,0是查看
  102. })
  103. .then(e => {
  104. this.$api.msg('核销成功');
  105. this.close();
  106. })
  107. .catch(e => {
  108. console.log(e);
  109. });
  110. },
  111. //调取扫描二维码
  112. sao() {
  113. let obj = this;
  114. // #ifndef H5
  115. uni.scanCode({
  116. success(e) {
  117. obj.code = e.result;
  118. obj.$refs.popuphx.open();
  119. }
  120. });
  121. // #endif
  122. // #ifdef H5
  123. let wx = require('jweixin-module');
  124. wx.scanQRCode({
  125. needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  126. scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
  127. success: function(res) {
  128. obj.code = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  129. obj.$refs.popuphx.open();
  130. }
  131. });
  132. // #endif
  133. }
  134. }
  135. };
  136. </script>
  137. <style lang="scss">
  138. page {
  139. height: 100%;
  140. background-color: #eeeded;
  141. padding: 0;
  142. margin: 0;
  143. }
  144. // 弹窗
  145. .hx-wrapper {
  146. width: 536rpx;
  147. height: 630rpx;
  148. position: relative;
  149. // background-color: #fff;
  150. .hx-img {
  151. width: 536rpx;
  152. height: 281rpx;
  153. image {
  154. width: 536rpx;
  155. height: 281rpx;
  156. }
  157. }
  158. .hx-close {
  159. position: absolute;
  160. left: 243rpx;
  161. bottom: -80rpx;
  162. width: 52rpx;
  163. height: 52rpx;
  164. image {
  165. width: 52rpx;
  166. height: 52rpx;
  167. }
  168. }
  169. .hx-body {
  170. width: 536rpx;
  171. height: 349rpx;
  172. background-color: #fff;
  173. border-radius: 0 0 10rpx 10rpx;
  174. .hx-title {
  175. width: 536rpx;
  176. font-size: 36rpx;
  177. font-weight: 500;
  178. color: #333333;
  179. line-height: 1;
  180. padding-top: 42rpx;
  181. text-align: center;
  182. }
  183. input {
  184. width: 439rpx;
  185. height: 68rpx;
  186. background: #dbf3e9;
  187. border-radius: 10rpx;
  188. margin: 39rpx auto 0;
  189. padding-left: 26rpx;
  190. .hx-placeholder {
  191. font-size: 26rpx;
  192. font-weight: 500;
  193. color: #52c696;
  194. }
  195. }
  196. .hx-btn {
  197. margin: 44rpx auto 0;
  198. width: 353rpx;
  199. height: 71rpx;
  200. background: #52c696;
  201. border-radius: 34rpx;
  202. font-size: 36rpx;
  203. font-weight: 500;
  204. color: #f8f9f9;
  205. line-height: 71rpx;
  206. text-align: center;
  207. }
  208. }
  209. }
  210. .content {
  211. background-color: #eeeded;
  212. margin: 0 30rpx;
  213. display: flex;
  214. flex-direction: column;
  215. }
  216. .background {
  217. width: 100%;
  218. height: 220rpx;
  219. background-color: #75e5b6;
  220. }
  221. .userInfo {
  222. margin-top: -110rpx;
  223. display: flex;
  224. flex-direction: column;
  225. align-items: center;
  226. background-color: #f9f9f9;
  227. border-radius: 19rpx;
  228. width: 100%;
  229. height: 300rpx;
  230. .userInfo-box {
  231. display: flex;
  232. flex-direction: column;
  233. align-items: center;
  234. .userInfo-img {
  235. margin: -65rpx 0 0 0;
  236. width: 130rpx;
  237. height: 130rpx;
  238. border: 5rpx solid #fff;
  239. border-radius: 50%;
  240. image {
  241. border-radius: 50%;
  242. width: 100%;
  243. height: 100%;
  244. }
  245. }
  246. .userInfo-xinxi {
  247. .title {
  248. margin: 20rpx 0;
  249. font-size: 32rpx;
  250. font-family: PingFang SC;
  251. font-weight: bold;
  252. color: #333333;
  253. text-align: center;
  254. }
  255. .phone {
  256. font-size: 28rpx;
  257. font-family: PingFang SC;
  258. font-weight: 500;
  259. color: #666666;
  260. line-height: 21rpx;
  261. }
  262. }
  263. .balance {
  264. margin-top: 10rpx;
  265. text-align: center;
  266. width: 500rpx;
  267. height: 60rpx;
  268. background: #52c696;
  269. border-radius: 30rpx;
  270. font-size: 28rpx;
  271. font-family: PingFang SC;
  272. font-weight: 500;
  273. color: #ffffff;
  274. line-height: 60rpx;
  275. }
  276. }
  277. }
  278. .userInfoList {
  279. display: flex;
  280. flex-wrap: wrap;
  281. justify-content: space-between;
  282. .userInfoList-top {
  283. position: relative;
  284. margin: 15rpx 0;
  285. display: flex;
  286. justify-content: center;
  287. align-items: center;
  288. width: 340rpx;
  289. height: 100rpx;
  290. background: #ffffff;
  291. border-radius: 20rpx;
  292. font-size: 30rpx;
  293. font-family: PingFang SC;
  294. font-weight: 500;
  295. color: #4d4d4d;
  296. line-height: 21rpx;
  297. .top {
  298. position: absolute;
  299. top: 50%;
  300. left: 30rpx;
  301. margin-top: -25rpx;
  302. width: 50rpx;
  303. height: 50rpx;
  304. image {
  305. width: 100%;
  306. height: 100%;
  307. }
  308. }
  309. }
  310. .userInfoList-bottom {
  311. margin-bottom: 15rpx;
  312. width: 340rpx;
  313. height: 250rpx;
  314. background: #f9f9f9;
  315. border-radius: 20rpx;
  316. display: flex;
  317. flex-direction: column;
  318. justify-content: center;
  319. align-items: center;
  320. .bottom {
  321. margin-bottom: 20rpx;
  322. width: 68rpx;
  323. height: 68rpx;
  324. image {
  325. width: 100%;
  326. height: 100%;
  327. }
  328. }
  329. }
  330. }
  331. </style>