敢为人鲜小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

477 lines
18 KiB

1 month ago
1 month ago
1 week ago
1 month ago
1 month ago
1 week ago
1 month ago
1 week ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="center-page">
  3. <!-- 顶部背景和个人信息 -->
  4. <view class="header" :style="{ backgroundImage: `url(${configList.config_bg_image})` }">
  5. <view class="user-info">
  6. <image class="avatar" :src="userInfo.headImage" mode="aspectFill"></image>
  7. <view class="user-name-id">
  8. <text class="user-name">{{ userInfo.nickName }}</text>
  9. <text class="user-id">ID:{{ userInfo.id }}</text>
  10. </view>
  11. </view>
  12. <view class="role-switch-btn" @tap="switchIdentity">
  13. <uv-icon name="reload" size="30rpx" color="#fff" style="margin-right: 6rpx;" />
  14. <text>切换为{{ identity ? '团员' : '团长'}}</text>
  15. </view>
  16. </view>
  17. <!-- 我的订单区域 -->
  18. <view class="orders-section">
  19. <view class="section-header">
  20. <text class="section-title">我的订单</text>
  21. <view class="view-all" @tap="navigateTo('/pages/index/order?status=all')">
  22. <text>全部</text>
  23. <uv-icon name="arrow-right" size="30rpx" color="#999" />
  24. </view>
  25. </view>
  26. <view class="order-types">
  27. <view class="order-type-item" v-if="identity === 0"
  28. @tap="navigateTo('/pages/index/order?status=pending')">
  29. <view class="order-icon-wrapper">
  30. <view class="green-circle">
  31. <uv-icon name="red-packet" size="44rpx" color="#fff" />
  32. </view>
  33. <uv-badge max="9" absolute :offset="[-10, -12]" bgColor="#FF2A2A"
  34. :value="userInfo.waitingPayCount" style="padding: 10rpx 15rpx;" />
  35. </view>
  36. <text class="order-type-text">待支付</text>
  37. </view>
  38. <view class="order-type-item" @tap="navigateTo('/pages/index/order?status=processing')">
  39. <view class="order-icon-wrapper">
  40. <view class="green-circle">
  41. <uv-icon name="chat" size="44rpx" color="#fff" />
  42. </view>
  43. <uv-badge max="9" absolute :offset="[-10, -12]" bgColor="#FF2A2A"
  44. :value="userInfo.waitingDiningCount" style="padding: 10rpx 15rpx;" />
  45. </view>
  46. <text class="order-type-text">待出餐</text>
  47. </view>
  48. <view class="order-type-item" @tap="navigateTo('/pages/index/order?status=shipping')">
  49. <view class="order-icon-wrapper">
  50. <view class="green-circle">
  51. <uv-icon name="chat" size="44rpx" color="#fff" />
  52. </view>
  53. <uv-badge max="9" absolute :offset="[-10, -12]" bgColor="#FF2A2A"
  54. :value="userInfo.deliveringCount" style="padding: 10rpx 15rpx;" />
  55. </view>
  56. <text class="order-type-text">送餐中</text>
  57. </view>
  58. <view class="order-type-item" @tap="navigateTo('/pages/index/order?status=delivered')">
  59. <view class="order-icon-wrapper">
  60. <view class="green-circle">
  61. <uv-icon name="chat" size="44rpx" color="#fff" />
  62. </view>
  63. <uv-badge max="9" absolute :offset="[-10, -12]" bgColor="#FF2A2A" :value="userInfo.pickupCount"
  64. style="padding: 10rpx 15rpx;" />
  65. </view>
  66. <text class="order-type-text">待取餐</text>
  67. </view>
  68. <view class="order-type-item" @tap="navigateTo('/pages/index/order?status=completed')">
  69. <view class="order-icon-wrapper">
  70. <view class="green-circle">
  71. <uv-icon name="chat" size="44rpx" color="#fff" />
  72. </view>
  73. <uv-badge max="9" absolute :offset="[-10, -12]" bgColor="#FF2A2A"
  74. :value="userInfo.completedCount" style="padding: 10rpx 15rpx;" />
  75. </view>
  76. <text class="order-type-text">已完成</text>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 团员功能区域 -->
  81. <view class="member-functions">
  82. <view class="section-header">
  83. <text class="section-title">{{ identity === 0 ? '团员功能' : '团长功能' }}</text>
  84. </view>
  85. <view class="function-grid" v-if="identity === 0">
  86. <view class="function-item" @tap="navigateTo('/pages_order/mine/updateUser')">
  87. <view class="function-icon">
  88. <uv-icon name="chat" size="94rpx" color="#019245" />
  89. </view>
  90. <text class="function-text">资料修改</text>
  91. </view>
  92. <view class="function-item" @tap="navigateTo('/pages_order/mine/team')">
  93. <view class="function-icon">
  94. <uv-icon name="chat" size="94rpx" color="#019245" />
  95. </view>
  96. <text class="function-text">团长申请</text>
  97. </view>
  98. <view class="function-item" @tap="navigateTo('/pages_order/mine/unbindTeam')">
  99. <view class="function-icon">
  100. <uv-icon name="chat" size="94rpx" color="#019245" />
  101. </view>
  102. <text class="function-text">解绑团长</text>
  103. </view>
  104. <view class="function-item" @tap="navigateTo('/pages_order/mine/share')">
  105. <view class="function-icon">
  106. <uv-icon name="chat" size="94rpx" color="#019245" />
  107. </view>
  108. <text class="function-text">推广链接</text>
  109. </view>
  110. <view class="function-item" @tap="navigateTo('/pages_order/mine/coupon')">
  111. <view class="function-icon">
  112. <uv-icon name="chat" size="94rpx" color="#019245" />
  113. </view>
  114. <text class="function-text">优惠券</text>
  115. </view>
  116. <view class="function-item" @tap="navigateTo('/pages_order/mine/wallet')">
  117. <view class="function-icon">
  118. <uv-icon name="chat" size="94rpx" color="#019245" />
  119. </view>
  120. <text class="function-text">钱包</text>
  121. </view>
  122. </view>
  123. <view class="function-grid" v-else>
  124. <view class="function-item" @tap="navigateTo('/pages_order/mine/updateUser')">
  125. <view class="function-icon">
  126. <uv-icon name="chat" size="94rpx" color="#019245" />
  127. </view>
  128. <text class="function-text">我的资料</text>
  129. </view>
  130. <view class="function-item" @tap="navigateTo('/pages_order/mine/myTeam')">
  131. <view class="function-icon">
  132. <uv-icon name="chat" size="94rpx" color="#019245" />
  133. </view>
  134. <text class="function-text">我的团员</text>
  135. </view>
  136. <view class="function-item" @tap="navigateTo('/pages_order/mine/team')">
  137. <view class="function-icon">
  138. <uv-icon name="chat" size="94rpx" color="#019245" />
  139. </view>
  140. <text class="function-text">团长信息</text>
  141. </view>
  142. <view class="function-item" v-if="userInfo.isManager === '1'" @tap="gotoManage">
  143. <view class="function-icon">
  144. <uv-icon name="list" size="94rpx" color="#019245" />
  145. </view>
  146. <text class="function-text">订单管理</text>
  147. </view>
  148. <view class="function-item" @tap="navigateTo('/pages_order/mine/share')">
  149. <view class="function-icon">
  150. <uv-icon name="chat" size="94rpx" color="#019245" />
  151. </view>
  152. <text class="function-text">推广链接</text>
  153. </view>
  154. <view class="function-item" @tap="navigateTo('/pages_order/mine/wallet')">
  155. <view class="function-icon">
  156. <uv-icon name="chat" size="94rpx" color="#019245" />
  157. </view>
  158. <text class="function-text">钱包</text>
  159. </view>
  160. </view>
  161. </view>
  162. <tabber select="center" />
  163. </view>
  164. </template>
  165. <script>
  166. import tabber from '@/components/base/tabbar.vue'
  167. export default {
  168. components: {
  169. tabber
  170. },
  171. data() {
  172. return {
  173. identity: uni.getStorageSync('identity') || 0
  174. }
  175. },
  176. methods: {
  177. gotoManage(){
  178. // 先判断是否是管理员身份
  179. if(this.userInfo && this.userInfo.isManager === '1'){
  180. this.navigateTo('/pages/index/orderManage?tabIndex=0')
  181. }else{
  182. uni.showToast({
  183. title: '您不是管理员身份',
  184. icon: 'error'
  185. })
  186. }
  187. },
  188. navigateTo(url) {
  189. this.$utils.navigateTo({
  190. url
  191. })
  192. },
  193. switchIdentity() {
  194. uni.showModal({
  195. title: '提示',
  196. content: `确定要切换为${this.identity ? '团员' : '团长'}吗?`,
  197. confirmColor: '#019245',
  198. success: (res) => {
  199. if (res.confirm){
  200. // 这里的切换逻辑
  201. if (this.identity == 0){
  202. this.$api('queryLeaderInfo', {}, res => {
  203. if (res.code == 200){
  204. if (res.result == null){
  205. // 如果申请都没有提交过
  206. uni.showModal({
  207. title: '提示',
  208. content: '您还没有提交过团长申请,请先提交申请',
  209. confirmColor: '#019245',
  210. confirmText: '提交申请',
  211. showCancel: false,
  212. success: (res) => {
  213. if (res.confirm) {
  214. this.$utils.navigateTo({
  215. url: '/pages_order/mine/team'
  216. })
  217. }
  218. }
  219. })
  220. }else if (res.result.status == '1'){
  221. this.identity = 1
  222. uni.setStorageSync('identity', this.identity)
  223. uni.showToast({
  224. title: '切换成功',
  225. icon: 'success',
  226. duration: 1000
  227. })
  228. }else if (res.result.status == '2'){
  229. uni.showModal({
  230. title: '提示',
  231. content: '团长申请失败,请重新申请',
  232. confirmColor: '#019245',
  233. confirmText: '重新申请',
  234. showCancel: false,
  235. success: (res) => {
  236. if (res.confirm){
  237. this.$utils.navigateTo({
  238. url: '/pages_order/mine/team'
  239. })
  240. }
  241. }
  242. })
  243. }else if (res.result.status == '0'){
  244. uni.showModal({
  245. title: '提示',
  246. content: '团长申请审核中,请耐心等待',
  247. confirmColor: '#019245',
  248. confirmText: '重新申请',
  249. cancelText: '等待申请',
  250. success: (res) => {
  251. if (res.confirm){
  252. this.$utils.navigateTo({
  253. url: '/pages_order/mine/team'
  254. })
  255. }
  256. }
  257. })
  258. }
  259. }
  260. })
  261. }else if (this.identity == 1){
  262. this.identity = 0
  263. uni.setStorageSync('identity', this.identity)
  264. uni.showToast({
  265. title: '切换成功',
  266. icon: 'success',
  267. duration: 1000
  268. })
  269. }
  270. }
  271. }
  272. })
  273. }
  274. },
  275. computed: {
  276. imageUrl() {
  277. return '/static/image/红烧肉.webp'
  278. }
  279. },
  280. onLoad() {
  281. this.$store.commit('getUserInfo')
  282. }
  283. }
  284. </script>
  285. <style lang="scss" scoped>
  286. .center-page {
  287. // min-height: 100vh;
  288. background-color: #f5f5f5;
  289. padding-bottom: 120rpx;
  290. }
  291. .header {
  292. position: relative;
  293. height: 340rpx;
  294. background-size: cover;
  295. background-position: center;
  296. color: #fff;
  297. padding: 60rpx 30rpx 0;
  298. display: flex;
  299. flex-direction: column;
  300. align-items: start;
  301. position: relative;
  302. .user-info {
  303. position: absolute;
  304. display: flex;
  305. align-items: center;
  306. margin-top: 30rpx;
  307. z-index: 2;
  308. left: 30rpx;
  309. top: 120rpx;
  310. .avatar {
  311. width: 110rpx;
  312. height: 110rpx;
  313. border-radius: 50%;
  314. }
  315. .user-name-id {
  316. margin-left: 30rpx;
  317. display: flex;
  318. flex-direction: column;
  319. .user-name {
  320. font-size: 32rpx;
  321. font-weight: bold;
  322. margin-bottom: 6rpx;
  323. }
  324. .user-id {
  325. font-size: 24rpx;
  326. opacity: 0.9;
  327. }
  328. }
  329. }
  330. .role-switch-btn {
  331. position: absolute;
  332. right: 0;
  333. top: 180rpx;
  334. background-color: rgba(255, 255, 255, 0.2);
  335. border-radius: 30rpx 0 0 30rpx;
  336. padding: 10rpx 20rpx;
  337. font-size: 24rpx;
  338. z-index: 2;
  339. display: flex;
  340. align-items: center;
  341. }
  342. }
  343. .orders-section {
  344. background-color: #fff;
  345. border-radius: 20rpx 20rpx 0 0;
  346. margin: -70rpx auto 0;
  347. padding: 15rpx;
  348. position: relative;
  349. z-index: 3;
  350. width: 90%;
  351. // margin: 0 auto;
  352. }
  353. .member-functions {
  354. background-color: #fff;
  355. padding: 30rpx;
  356. margin-top: 20rpx;
  357. width: 88%;
  358. border-radius: 20rpx;
  359. margin: 30rpx auto 0;
  360. }
  361. .section-header {
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. margin-bottom: 40rpx;
  366. .section-title {
  367. font-size: 32rpx;
  368. font-weight: 500;
  369. position: relative;
  370. padding-left: 15rpx;
  371. }
  372. .view-all {
  373. display: flex;
  374. align-items: center;
  375. font-size: 26rpx;
  376. color: $uni-color-third;
  377. }
  378. }
  379. .order-types {
  380. // background-color: red;
  381. display: flex;
  382. justify-content: space-around;
  383. .order-type-item {
  384. display: flex;
  385. flex-direction: column;
  386. align-items: center;
  387. // width: 20%;
  388. .order-icon-wrapper {
  389. position: relative;
  390. margin-bottom: 4rpx;
  391. .green-circle {
  392. width: 70rpx;
  393. height: 70rpx;
  394. background-color: $uni-color;
  395. border-radius: 50%;
  396. display: flex;
  397. justify-content: center;
  398. align-items: center;
  399. }
  400. }
  401. .order-type-text {
  402. font-size: 26rpx;
  403. color: #666;
  404. margin-top: 8rpx;
  405. }
  406. }
  407. }
  408. .function-grid {
  409. display: flex;
  410. flex-wrap: wrap;
  411. .function-item {
  412. width: 25%;
  413. display: flex;
  414. flex-direction: column;
  415. align-items: center;
  416. margin-bottom: 40rpx;
  417. .function-icon {
  418. width: 80rpx;
  419. height: 80rpx;
  420. display: flex;
  421. justify-content: center;
  422. align-items: center;
  423. margin-bottom: 16rpx;
  424. }
  425. .function-text {
  426. font-size: 26rpx;
  427. color: #333;
  428. }
  429. }
  430. }
  431. </style>