merchant.vue 8.8 KB

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