mine.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <view class="mine">
  3. <!-- 状态栏占位 -->
  4. <view class="mine__nav" :style="{ height: 77 + 'px' }" />
  5. <view class="mine__person">
  6. <view class="mine__person--info">
  7. <view @click="$Router.push('/pageMerchant/mineModule/personalInfo')">
  8. <image :src="merchantInfo.merchant.logo" style="width: 140rpx; height: 140rpx; border-radius: 50%"
  9. v-if="merchantInfo.merchant.logo" />
  10. <image src="@/static/QR57a.jpg" style="width: 140rpx; height: 140rpx; border-radius: 50%" v-else />
  11. </view>
  12. <view class="userName">
  13. <view>
  14. <view v-if="merchantInfo.storeName"> {{ merchantInfo.storeName }}</view>
  15. <view v-else> 微信用户</view>
  16. </view>
  17. <view>
  18. <view v-if="merchantInfo.mobileNumber" class="text">
  19. +86 {{ merchantInfo.mobileNumber }}
  20. </view>
  21. <view v-else class="text">
  22. <text style="color: #f6bf3f"> 您当前还未认证,</text>
  23. <text @click="$Router.push('/pageMerchant/mineModule/certification/index')">
  24. 去认证>
  25. </text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="status" :style="{ 'background-color': getStatusColor(state) }" @click="show = true">
  30. <view style="margin-right: 6rpx">{{ stateName }}</view>
  31. <u-icon name="play-right-fill" color="#fff" size="12" />
  32. </view>
  33. </view>
  34. </view>
  35. <view class="mine__main">
  36. <view class="mine__main--purse">
  37. <view class="wallet">
  38. <view class="wallet--title">我的钱包</view>
  39. <view class="wallet--more">
  40. <text>查看钱包余额</text>
  41. <u-icon name="arrow-right" color="#333" size="14" />
  42. </view>
  43. </view>
  44. <view class="walletInfo">
  45. <view v-for="item,index in incomeList" :key="index">
  46. <view class="text-title">{{item.title}}</view>
  47. <view class="text-data">¥{{item.num}}</view>
  48. <!-- <view class="text-info">最高可用</view> -->
  49. </view>
  50. </view>
  51. <!-- <view class="shortcut">
  52. <view style="display: flex">
  53. <view>快捷支付</view>
  54. <view style="margin: 0 20rpx">|</view>
  55. <view>一银升级银行卡用于麦付</view>
  56. </view>
  57. <u-icon name="arrow-right" color="#fff" size="14" />
  58. </view> -->
  59. </view>
  60. <view class="mine__main--setting">
  61. <template v-for="item in list1">
  62. <u-cell size="large" :border="false" :key="item.name" :title="item.name" isLink :url="item.url">
  63. <image slot="icon" src="@/static/tools.jpg" style="width: 60rpx; height: 60rpx" />
  64. </u-cell>
  65. </template>
  66. </view>
  67. <view class="mine__main--setting">
  68. <template v-for="item in list2">
  69. <u-cell size="large" :border="false" :key="item.name" :title="item.name" isLink :url="item.url">
  70. <image slot="icon" src="@/static/tools.jpg" style="width: 60rpx; height: 60rpx" />
  71. </u-cell>
  72. </template>
  73. </view>
  74. </view>
  75. <!-- 营业状态选择弹框 -->
  76. <u-picker :show="show" :columns="columns" @cancel="cancel" @confirm="confirm" keyName="label"></u-picker>
  77. <!-- 商家认证的弹框 -->
  78. <u-modal :show="showAut" :title="title" :content="content" :confirmText="'开始认证'" :cancelText="'返回用户端'"
  79. :showCancelButton="true" @confirm="confirmSwitch" @cancel="showAut = false"></u-modal>
  80. <!-- <tabbar currentTab="merchantMine" /> -->
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. getMerchantAuthData
  86. } from '@/api/merchant/merchantAuth';
  87. import {
  88. updateBusinessStatus
  89. } from '@/api/merchant/mine';
  90. import {
  91. phoneEncryption
  92. } from '@/utils/tools';
  93. export default {
  94. data() {
  95. return {
  96. state: 0,
  97. stateName: '营业中',
  98. show: false,
  99. showAut: false,
  100. title: '商家认证',
  101. content: '进入商家端前,我们需要一定的认证',
  102. merchantInfo: {},
  103. incomeList: [{
  104. num: '0.00',
  105. title: '总收益',
  106. },
  107. {
  108. num: '0.00',
  109. title: '本月收益',
  110. },
  111. {
  112. num: '0.00',
  113. title: '本周收益',
  114. },
  115. {
  116. num: '0.00',
  117. title: '可提现',
  118. },
  119. ],
  120. columns: [
  121. // 营业状态 0-营业中,1-休息中
  122. [{
  123. label: '营业中',
  124. id: '0',
  125. },
  126. {
  127. label: '休息中',
  128. id: '1',
  129. },
  130. ],
  131. ],
  132. list1: [{
  133. id: '1',
  134. name: '门店环境',
  135. url: '/pageMerchant/mineModule/storeEnviron',
  136. },
  137. // {
  138. // id: '2',
  139. // name: '我要开店',
  140. // url: '/pages/merchant/mine/openStore/index',
  141. // },
  142. {
  143. id: '3',
  144. name: '资质信息',
  145. url: '/pageMerchant/mineModule/openStoreAppealDetail',
  146. },
  147. ],
  148. list2: [{
  149. id: '1',
  150. name: '意见反馈',
  151. url: '',
  152. },
  153. {
  154. id: '2',
  155. name: '设置',
  156. url: '/pageMerchant/mineModule/setting/index',
  157. },
  158. ],
  159. };
  160. },
  161. created() {
  162. this.getMerchantAuth();
  163. },
  164. mounted() {
  165. if (this.merchantInfo) {
  166. this.showAut = false;
  167. } else {
  168. this.showAut = true;
  169. }
  170. console.log(this.merchantInfo.merchant.id, '111111111');
  171. },
  172. methods: {
  173. /*===========================================================*/
  174. // 获取商家信息
  175. async getMerchantAuth() {
  176. let res = await getMerchantAuthData();
  177. if (res.code === 'OK') {
  178. // 将数据存储到vuex中
  179. this.merchantInfo = Object.assign({}, {
  180. ...res.data,
  181. mobileNumber: phoneEncryption(res.data.mobileNumber),
  182. }, );
  183. this.$store.commit('SET_MERCHANTINFO', res.data);
  184. }
  185. },
  186. /*===========================================================*/
  187. // 开始认证
  188. confirmSwitch() {
  189. uni.navigateTo({
  190. url: '/pageMerchant/mineModule/certification/index'
  191. });
  192. },
  193. /*===========================================================*/
  194. // 修改商家状态
  195. confirm(val) {
  196. this.state = val.value[0].id;
  197. this.stateName = val.value[0].label;
  198. this.show = false;
  199. updateBusinessStatus(this.merchantInfo.merchant.id, {
  200. businessStatus: this.state
  201. }).then(
  202. res => {
  203. if (res.code === 'OK') {
  204. this.$u.toast('修改成功');
  205. }
  206. },
  207. );
  208. },
  209. getStatusColor(state) {
  210. if (state === 0) {
  211. return '#19be6b';
  212. } else if (state === 1) {
  213. return '#ff9900';
  214. }
  215. },
  216. /*===========================================================*/
  217. },
  218. };
  219. </script>
  220. <style lang="scss" scoped>
  221. .mine {
  222. min-height: calc(100vh - 80rpx);
  223. box-sizing: border-box;
  224. &__nav {
  225. background-color: $uni-bg-color-primary;
  226. }
  227. &__person {
  228. height: 160rpx;
  229. padding: $uni-bg-padding-sm;
  230. background-color: $uni-bg-color-primary;
  231. position: relative;
  232. &--info {
  233. color: #fff;
  234. display: flex;
  235. .userName {
  236. width: 400rpx;
  237. font-size: 36rpx;
  238. margin: 20rpx 0 0 16rpx;
  239. .text {
  240. margin-top: 15rpx;
  241. font-size: 28rpx;
  242. }
  243. }
  244. .status {
  245. display: flex;
  246. position: absolute;
  247. bottom: 80rpx;
  248. padding-left: 20rpx;
  249. right: 0;
  250. width: 150rpx;
  251. height: 60rpx;
  252. font-size: 25rpx;
  253. align-items: center;
  254. justify-content: center;
  255. box-sizing: border-box;
  256. border-radius: 30rpx 0 0 30rpx;
  257. background-color: rgba(255, 255, 255, 0.3);
  258. }
  259. }
  260. }
  261. &__main {
  262. padding: $uni-bg-padding-sm;
  263. &--purse {
  264. background-color: $uni-bg-color;
  265. padding: $uni-bg-padding-sm;
  266. border-radius: $uni-border-radius-base;
  267. .wallet {
  268. display: flex;
  269. justify-content: space-between;
  270. font-size: 28rpx;
  271. &--title {
  272. color: #000;
  273. font-size: 36rpx;
  274. font-weight: 700;
  275. }
  276. &--more {
  277. color: #333;
  278. display: flex;
  279. justify-content: center;
  280. align-items: center;
  281. }
  282. }
  283. .walletInfo {
  284. margin: 40rpx 0;
  285. color: #333;
  286. display: flex;
  287. text-align: center;
  288. justify-content: space-around;
  289. }
  290. // .shortcut {
  291. // height: 70rpx;
  292. // padding: 0 20rpx;
  293. // color: #fff;
  294. // font-size: 28rpx;
  295. // display: flex;
  296. // align-items: center;
  297. // justify-content: space-between;
  298. // background-color: $uni-bg-color-primary;
  299. // border-radius: $uni-border-radius-sm;
  300. // }
  301. }
  302. &--setting {
  303. margin: 20rpx 0;
  304. background-color: $uni-bg-color;
  305. padding: $uni-bg-padding-sm;
  306. border-radius: $uni-border-radius-base;
  307. }
  308. }
  309. }
  310. .text-title {
  311. font-size: 34rpx;
  312. }
  313. .text-data {
  314. font-size: 40rpx;
  315. margin: 15rpx 0;
  316. font-weight: 700;
  317. }
  318. .text-info {
  319. font-size: 24rpx;
  320. }
  321. </style>