index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <view class="content">
  3. <view class="user-info-box">
  4. <image class="user-image" :src="userData.headImage"></image>
  5. <view class="user-info">
  6. <view class="user-logoin-title">{{userData.tenantName}}</view>
  7. <view class="user-type">
  8. <view class="iconfont iconshangjia-shanghu"></view>
  9. <view>商家用户</view>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="order-box">
  14. <view class="order-item" @click="orderClick(2)">
  15. <view class="iconfont icondaifahuo order-item-icon">
  16. <view v-if="num.unSend" class="order-item-icon-num">{{num.unSend}}</view>
  17. </view>
  18. <view class="order-item-text">待发货</view>
  19. </view>
  20. <view class="order-item" @click="orderClick(3)">
  21. <view class="iconfont icondaishouhuo order-item-icon">
  22. <view v-if="num.unReceive" class="order-item-icon-num">{{num.unReceive}}</view>
  23. </view>
  24. <view class="order-item-text">已发货</view>
  25. </view>
  26. <view class="order-item" @click="orderClick(4)">
  27. <view class="iconfont iconyishouhuo order-item-icon">
  28. <view v-if="num.unComment" class="order-item-icon-num">{{num.unComment}}</view>
  29. </view>
  30. <view class="order-item-text">已收货</view>
  31. </view>
  32. <view class="order-item" @click="orderClick(5)">
  33. <view class="iconfont icondaipingjia order-item-icon">
  34. <view v-if="num.finished" class="order-item-icon-num">{{num.finished}}</view>
  35. </view>
  36. <view class="order-item-text">已评价</view>
  37. </view>
  38. </view>
  39. <view class="cell-group">
  40. <view class="item-btn" @click="pickClick()">
  41. <view class="iconfont iconcaizhai item-btn-icon"></view>
  42. <view class="item-btn-text" v-if="num.selfOrder">自助采摘 ({{num.selfOrder}})</view>
  43. <view class="item-btn-text" v-if="!num.selfOrder">自助采摘</view>
  44. <view class="iconfont iconfangxiang"></view>
  45. </view>
  46. <view class="item-btn" @click="authorizeClick()" v-if="userData.isMaster">
  47. <view class="iconfont iconquanxian item-btn-icon"></view>
  48. <view class="item-btn-text">授权</view>
  49. <view class="iconfont iconfangxiang"></view>
  50. </view>
  51. <view class="item-btn" @click="couponClick()">
  52. <view class="iconfont iconyouhuiquan item-btn-icon"></view>
  53. <view class="item-btn-text">优惠券管理</view>
  54. <view class="iconfont iconfangxiang"></view>
  55. </view>
  56. </view>
  57. <view class="cell-group">
  58. <view class="item-btn" @click="infoClick()">
  59. <view class="iconfont icondianpu item-btn-icon"></view>
  60. <view class="item-btn-text">商户信息</view>
  61. <view class="iconfont iconfangxiang"></view>
  62. </view>
  63. <view class="item-btn" @click="aboutUsClick()">
  64. <view class="iconfont iconguanyu item-btn-icon"></view>
  65. <view class="item-btn-text">关于我们</view>
  66. <view class="iconfont iconfangxiang"></view>
  67. </view>
  68. <view class="item-btn" @click="modalShow=true">
  69. <view class="iconfont iconguanyu item-btn-icon"></view>
  70. <view class="item-btn-text">后台管理信息</view>
  71. <view class="iconfont iconfangxiang"></view>
  72. </view>
  73. <view class="item-btn" @click="loginModal=true">
  74. <view class="iconfont iconguanyu item-btn-icon"></view>
  75. <view class="item-btn-text">退出登录</view>
  76. <view class="iconfont iconfangxiang"></view>
  77. </view>
  78. </view>
  79. <u-top-tips ref="uTips"></u-top-tips>
  80. <u-modal v-model="modalShow" title="后台管理信息" :content="'账号:'+manageInfo.account+',密码'+ manageInfo.password"></u-modal>
  81. <u-modal v-model="loginModal" content="确定退出登录?" @confirm="loginOut()" :async-close="true" :show-cancel-button="true"></u-modal>
  82. </view>
  83. </template>
  84. <script>
  85. const NET = require('@/utils/request')
  86. const API = require('@/config/api')
  87. export default {
  88. data() {
  89. return {
  90. integral: '',
  91. userData: {
  92. userId: '',
  93. userName: '',
  94. headImage: '',
  95. isMaster: 0,
  96. },
  97. manageInfo: {},
  98. modalShow: false,
  99. loginModal: false,
  100. num: {
  101. unComment: 0, // 待评价
  102. unPay: 0, // 待付款
  103. unReceive: 0, // 待收货
  104. unSend: 0, // 待发货
  105. finished: 0, // 已评价
  106. selfOrder: 0,// 自助采摘订单
  107. }
  108. }
  109. },
  110. onShow() {
  111. this.userData = uni.getStorageSync("userData")||{}
  112. NET.request(API.getManageInfo, {}, 'POST').then(res => {
  113. this.manageInfo = res.data
  114. }).catch(error => {
  115. this.$refs.uTips.show({
  116. title: error.data.msg,
  117. type: 'warning',
  118. })
  119. })
  120. this.getNum()
  121. },
  122. methods: {
  123. // 注销
  124. loginOut() {
  125. try {
  126. uni.clearStorageSync();
  127. this.loginModal = false
  128. uni.reLaunch({
  129. url: '/pages/index/index'
  130. });
  131. } catch (e) {
  132. console.log(e, '退出登录')
  133. }
  134. },
  135. // 我的订单
  136. orderClick(type) {
  137. if(!this.userData.roleInfos.some(v=>v.menuInfos.some(vv=>vv.label == '订单管理'))){
  138. this.$refs.uTips.show({
  139. title: '没有授权使用,请联系商户负责人',
  140. type: 'warning',
  141. })
  142. return;
  143. }
  144. uni.navigateTo({
  145. url: '/pagesMain/orderList?type=' + type
  146. });
  147. },
  148. // 获取订单数量
  149. getNum() {
  150. NET.request(API.getOrderNum, {}, 'GET').then(res => {
  151. if (res.isSuccess) {
  152. this.num = res.data
  153. } else {
  154. this.$refs.uTips.show({
  155. title: res.msg,
  156. type: 'warning',
  157. })
  158. }
  159. }).catch(error => {
  160. this.$refs.uTips.show({
  161. title: '获取个人信息失败',
  162. type: 'warning',
  163. })
  164. })
  165. },
  166. // 自助采摘
  167. pickClick() {
  168. if(!this.userData.roleInfos.some(v=>v.menuInfos.some(vv=>vv.label == '订单管理'))){
  169. this.$refs.uTips.show({
  170. title: '没有授权使用,请联系商户负责人',
  171. type: 'warning',
  172. })
  173. return;
  174. }
  175. uni.navigateTo({
  176. // url: '/pagesMedia/pickVideo',
  177. url: '/pagesMain/pickOrderList?type=' + 6
  178. });
  179. },
  180. // 授权
  181. authorizeClick() {
  182. uni.navigateTo({
  183. url: '/pagesMain/authorizeList'
  184. });
  185. },
  186. // 优惠券管理
  187. couponClick() {
  188. if(!this.userData.roleInfos.some(v=>v.menuInfos.some(vv=>vv.label == '优惠券管理'))){
  189. this.$refs.uTips.show({
  190. title: '没有授权使用,请联系商户负责人',
  191. type: 'warning',
  192. })
  193. return;
  194. }
  195. uni.navigateTo({
  196. url: '/pagesMain/couponList'
  197. });
  198. },
  199. // 商户信息
  200. infoClick() {
  201. if(!this.userData.isMaster) {
  202. this.$refs.uTips.show({
  203. title: '没有授权使用,请联系商户负责人',
  204. type: 'warning',
  205. })
  206. return;
  207. }
  208. uni.navigateTo({
  209. url: '/pagesMain/registerForm'
  210. });
  211. },
  212. // 关于我们
  213. aboutUsClick() {
  214. uni.navigateTo({
  215. url: '/pagesMain/aboutUs'
  216. });
  217. },
  218. // 获取后台管理账号密码
  219. manageInfoClick(){
  220. this.modalShow = true
  221. }
  222. }
  223. }
  224. </script>
  225. <style lang='scss'>
  226. page {
  227. width: 100%;
  228. height: 100%;
  229. }
  230. .content {
  231. width: 100%;
  232. height: 100%;
  233. float: left;
  234. background-color: #F3F3F3;
  235. .user-info-box {
  236. width: 100%;
  237. height: 120px;
  238. float: left;
  239. box-sizing: border-box;
  240. padding: 15px;
  241. position: relative;
  242. background-size: 100% 195px;
  243. background-position: center top;
  244. background-repeat: no-repeat;
  245. background-image: url(@/static/images/userBg.png);
  246. .user-image {
  247. width: 65px;
  248. height: 65px;
  249. object-fit: cover;
  250. border-radius: 50%;
  251. float: left;
  252. }
  253. .user-info {
  254. width: calc(100% - 85px);
  255. float: left;
  256. display: flex;
  257. flex-direction: column;
  258. padding: 10px 15px;
  259. box-sizing: border-box;
  260. z-index: 10;
  261. .user-logoin-title {
  262. font-size: 36upx;
  263. font-weight: 500;
  264. color: rgba(255, 255, 255, 1);
  265. }
  266. .user-type {
  267. width: 70px;
  268. height: 20px;
  269. background: #FFFFFF;
  270. color: #55AF3D;
  271. display: flex;
  272. align-items: center;
  273. justify-content: center;
  274. font-size: 12px;
  275. }
  276. }
  277. }
  278. .order-box {
  279. width: 690upx;
  280. height: 170upx;
  281. float: left;
  282. background: rgba(255, 255, 255, 1);
  283. box-shadow: 0px 0px 10upx 0px rgba(51, 51, 51, 0.1);
  284. border-radius: 10upx;
  285. display: flex;
  286. flex-direction: row;
  287. align-items: center;
  288. z-index: 10;
  289. position: relative;
  290. left: 50%;
  291. transform: translateX(-50%);
  292. margin-top: -20px;
  293. margin-bottom: 10px;
  294. .order-line {
  295. width: 12upx;
  296. height: 106upx;
  297. }
  298. .order-item {
  299. flex: 1;
  300. display: flex;
  301. flex-direction: column;
  302. align-items: center;
  303. justify-content: center;
  304. .order-item-icon {
  305. color: #52A63A;
  306. font-size: 30px;
  307. display: flex;
  308. position: relative;
  309. .order-item-icon-num {
  310. background: #ffffff;
  311. width: 22px;
  312. height: 20px;
  313. font-size: 12px;
  314. border-radius: 50%;
  315. color: #52A63A;
  316. text-align: center;
  317. position: absolute;
  318. left: 20px;
  319. border: 1px solid #52A63A;
  320. line-height: 20px;
  321. }
  322. }
  323. .order-item-text {
  324. font-size: 28upx;
  325. margin-top: 10upx;
  326. font-weight: 500;
  327. }
  328. }
  329. }
  330. .cell-group {
  331. width: 100%;
  332. float: left;
  333. margin-bottom: 10px;
  334. .item-btn {
  335. width: 100%;
  336. height: 50px;
  337. display: flex;
  338. flex-direction: row;
  339. align-items: center;
  340. box-sizing: border-box;
  341. background-color: #fff;
  342. padding: 0 15px;
  343. .item-btn-icon {
  344. color: #52A63A;
  345. font-size: 20px;
  346. }
  347. .item-btn-text {
  348. font-size: 28upx;
  349. margin-left: 20upx;
  350. font-weight: 500;
  351. flex: 1;
  352. color: rgba(102, 102, 102, 1);
  353. }
  354. }
  355. }
  356. }
  357. </style>