mine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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
  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. <text @click="$Router.push('/pageMerchant/mineModule/certification/index')">
  31. 去认证>
  32. </text>
  33. </view> -->
  34. </view>
  35. </view>
  36. <view
  37. class="status"
  38. :style="{ 'background-color': getStatusColor(state) }"
  39. @click="show = true"
  40. >
  41. <view style="margin-right: 6rpx">{{ stateName }}</view>
  42. <u-icon name="play-right-fill" color="#fff" size="12" />
  43. </view>
  44. </view>
  45. </view>
  46. <view class="mine__main">
  47. <view class="mine__main--purse" @click="toMyPurse">
  48. <view class="wallet">
  49. <view class="wallet--title">我的钱包</view>
  50. <view class="wallet--more">
  51. <text>查看钱包余额</text>
  52. <u-icon name="arrow-right" color="#333" size="14" />
  53. </view>
  54. </view>
  55. <view class="walletInfo">
  56. <view v-for="(item, index) in incomeList" :key="index">
  57. <view class="text-title">{{ item.title }}</view>
  58. <view class="text-data">¥{{ item.num }}</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
  74. size="large"
  75. :border="false"
  76. :key="item.name"
  77. :title="item.name"
  78. isLink
  79. :url="item.url"
  80. >
  81. <image slot="icon" src="@/static/tools.jpg" style="width: 60rpx; height: 60rpx" />
  82. </u-cell>
  83. </template>
  84. </view>
  85. <view class="mine__main--setting">
  86. <template v-for="item in list2">
  87. <u-cell
  88. size="large"
  89. :border="false"
  90. :key="item.name"
  91. :title="item.name"
  92. isLink
  93. :url="item.url"
  94. >
  95. <image slot="icon" src="@/static/tools.jpg" style="width: 60rpx; height: 60rpx" />
  96. </u-cell>
  97. </template>
  98. </view>
  99. </view>
  100. <!-- 营业状态选择弹框 -->
  101. <u-picker
  102. :show="show"
  103. :columns="columns"
  104. @cancel="cancel"
  105. @confirm="confirm"
  106. keyName="label"
  107. ></u-picker>
  108. <!-- 商家认证的弹框 -->
  109. <u-modal
  110. :show="showAut"
  111. :title="title"
  112. :content="content"
  113. :confirmText="'开始认证'"
  114. :cancelText="'返回用户端'"
  115. :showCancelButton="true"
  116. @confirm="confirmSwitch"
  117. @cancel="showAut = false"
  118. ></u-modal>
  119. <tabbar currentTab="merchantMine" />
  120. </view>
  121. </template>
  122. <script>
  123. import { getMerchantAuthData, getMerchantPures } from '@/api/merchant/merchantAuth';
  124. import { updateBusinessStatus } from '@/api/merchant/mine';
  125. import { phoneEncryption } from '@/utils/tools';
  126. export default {
  127. data() {
  128. return {
  129. state: 0,
  130. stateName: '营业中',
  131. show: false,
  132. showAut: false,
  133. title: '商家认证',
  134. content: '进入商家端前,我们需要一定的认证',
  135. merchantInfo: {},
  136. // purse:{}, // 钱包信息
  137. incomeList: [
  138. {
  139. num: '0.00',
  140. title: '总收益',
  141. },
  142. {
  143. num: '0.00',
  144. title: '今日收益',
  145. },
  146. {
  147. num: '0.00',
  148. title: '昨日收益',
  149. },
  150. {
  151. num: '0.00',
  152. title: '可提现',
  153. },
  154. ],
  155. columns: [
  156. // 营业状态 0-营业中,1-休息中
  157. [
  158. {
  159. label: '营业中',
  160. id: '0',
  161. },
  162. {
  163. label: '休息中',
  164. id: '1',
  165. },
  166. ],
  167. ],
  168. list1: [
  169. {
  170. id: '1',
  171. name: '门店环境',
  172. url: '/pageMerchant/mineModule/storeEnviron',
  173. },
  174. // {
  175. // id: '2',
  176. // name: '我要开店',
  177. // url: '/pages/merchant/mine/openStore/index',
  178. // },
  179. {
  180. id: '3',
  181. name: '资质信息',
  182. url: '/pageMerchant/mineModule/openStoreAppealDetail',
  183. // url: '/pageMerchant/mineModule/certification/storeInformation',
  184. },
  185. ],
  186. list2: [
  187. {
  188. id: '1',
  189. name: '意见反馈',
  190. url: 'PageMine/feedback?channelType=1',
  191. },
  192. {
  193. id: '2',
  194. name: '设置',
  195. url: '/pageMerchant/mineModule/setting/index',
  196. },
  197. ],
  198. };
  199. },
  200. created() {
  201. this.getMerchantAuth();
  202. this.request();
  203. },
  204. mounted() {
  205. if (this.merchantInfo) {
  206. this.showAut = false;
  207. } else {
  208. this.showAut = true;
  209. }
  210. },
  211. methods: {
  212. /*===========================================================*/
  213. // 获取商家信息
  214. async getMerchantAuth() {
  215. let res = await getMerchantAuthData();
  216. if (res.code === 'OK') {
  217. // 将数据存储到vuex中
  218. console.log(res.data, '存储到vuex的数据');
  219. this.merchantInfo = Object.assign(
  220. {},
  221. {
  222. ...res.data,
  223. mobileNumber: phoneEncryption(res.data && res.data.mobileNumber),
  224. },
  225. );
  226. this.$store.commit('SET_MERCHANTINFO', res.data);
  227. }
  228. },
  229. // 获取钱包信息
  230. async request() {
  231. const res = await getMerchantPures(this.$store.state.data.merchantInfo.merchant.id);
  232. this.purse = res.data;
  233. if (res.data) {
  234. this.incomeList[0].num = res.data.walletDTO.totalEarnings
  235. ? res.data.walletDTO.totalEarnings
  236. : '0.00';
  237. this.incomeList[1].num = res.data.walletDTO.todayEarnings
  238. ? res.data.walletDTO.todayEarnings
  239. : '0.00';
  240. this.incomeList[2].num = res.data.walletDTO.yesterdayEarnings
  241. ? res.data.walletDTO.yesterdayEarnings
  242. : '0.00';
  243. this.incomeList[3].num = res.data.walletDTO.withdraw ? res.data.walletDTO.withdraw : '0.00';
  244. }
  245. },
  246. /*===========================================================*/
  247. // 开始认证
  248. confirmSwitch() {
  249. uni.navigateTo({
  250. url: '/pageMerchant/mineModule/certification/index',
  251. });
  252. },
  253. /*===========================================================*/
  254. // 修改商家状态
  255. confirm(val) {
  256. this.state = val.value[0].id;
  257. this.stateName = val.value[0].label;
  258. this.show = false;
  259. updateBusinessStatus(this.merchantInfo.merchant.id, {
  260. businessStatus: this.state,
  261. }).then(res => {
  262. if (res.code === 'OK') {
  263. this.$u.toast('修改成功');
  264. }
  265. });
  266. },
  267. getStatusColor(state) {
  268. if (state === 0) {
  269. return '#19be6b';
  270. } else if (state === 1) {
  271. return '#ff9900';
  272. }
  273. },
  274. toMyPurse() {
  275. uni.navigateTo({
  276. url: '/pageMerchant/mineModule/myPurse/purse',
  277. });
  278. },
  279. },
  280. };
  281. </script>
  282. <style lang="scss" scoped>
  283. .mine {
  284. min-height: calc(100vh - 80rpx);
  285. box-sizing: border-box;
  286. &__nav {
  287. background-color: $uni-bg-color-primary;
  288. }
  289. &__person {
  290. height: 160rpx;
  291. padding: $uni-bg-padding-sm;
  292. background-color: $uni-bg-color-primary;
  293. position: relative;
  294. &--info {
  295. color: #fff;
  296. display: flex;
  297. .userName {
  298. width: 400rpx;
  299. font-size: 36rpx;
  300. margin: 20rpx 0 0 16rpx;
  301. .text {
  302. margin-top: 15rpx;
  303. font-size: 28rpx;
  304. }
  305. }
  306. .status {
  307. display: flex;
  308. position: absolute;
  309. bottom: 80rpx;
  310. padding-left: 20rpx;
  311. right: 0;
  312. width: 150rpx;
  313. height: 60rpx;
  314. font-size: 25rpx;
  315. align-items: center;
  316. justify-content: center;
  317. box-sizing: border-box;
  318. border-radius: 30rpx 0 0 30rpx;
  319. background-color: rgba(255, 255, 255, 0.3);
  320. }
  321. }
  322. }
  323. &__main {
  324. padding: $uni-bg-padding-sm;
  325. &--purse {
  326. background-color: $uni-bg-color;
  327. padding: $uni-bg-padding-sm;
  328. border-radius: $uni-border-radius-base;
  329. .wallet {
  330. display: flex;
  331. justify-content: space-between;
  332. font-size: 28rpx;
  333. &--title {
  334. color: #000;
  335. font-size: 36rpx;
  336. font-weight: 700;
  337. }
  338. &--more {
  339. color: #333;
  340. display: flex;
  341. justify-content: center;
  342. align-items: center;
  343. }
  344. }
  345. .walletInfo {
  346. margin: 40rpx 0;
  347. color: #333;
  348. display: flex;
  349. text-align: center;
  350. justify-content: space-around;
  351. }
  352. // .shortcut {
  353. // height: 70rpx;
  354. // padding: 0 20rpx;
  355. // color: #fff;
  356. // font-size: 28rpx;
  357. // display: flex;
  358. // align-items: center;
  359. // justify-content: space-between;
  360. // background-color: $uni-bg-color-primary;
  361. // border-radius: $uni-border-radius-sm;
  362. // }
  363. }
  364. &--setting {
  365. margin: 20rpx 0;
  366. background-color: $uni-bg-color;
  367. padding: $uni-bg-padding-sm;
  368. border-radius: $uni-border-radius-base;
  369. }
  370. }
  371. }
  372. .text-title {
  373. font-size: 34rpx;
  374. }
  375. .text-data {
  376. font-size: 40rpx;
  377. margin: 15rpx 0;
  378. font-weight: 700;
  379. }
  380. .text-info {
  381. font-size: 24rpx;
  382. }
  383. </style>