index.vue 9.0 KB

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