merchant.vue 7.8 KB

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