敢为人鲜小程序前端代码仓库
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.

404 lines
13 KiB

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 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="center-page">
  3. <!-- 顶部背景和个人信息 -->
  4. <view class="header" :style="{ 'background-image': 'url(/static/image/红烧肉.webp)' }">
  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">团员功能</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" @tap="navigateTo('/pages_order/mine/share')">
  143. <view class="function-icon">
  144. <uv-icon name="chat" size="94rpx" color="#019245" />
  145. </view>
  146. <text class="function-text">推广链接</text>
  147. </view>
  148. <view class="function-item" @tap="navigateTo('/pages_order/mine/wallet')">
  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>
  155. </view>
  156. <tabber select="center" />
  157. </view>
  158. </template>
  159. <script>
  160. import tabber from '@/components/base/tabbar.vue'
  161. // import { mockUserInfo } from '@/static/js/mockUserInfo.js'
  162. // import { unix } from 'dayjs'
  163. export default {
  164. components: {
  165. tabber
  166. },
  167. data() {
  168. return {
  169. // userInfo: mockUserInfo,
  170. identity: uni.getStorageSync('identity') || 0
  171. }
  172. },
  173. methods: {
  174. navigateTo(url) {
  175. this.$utils.navigateTo({
  176. url
  177. })
  178. },
  179. switchIdentity() {
  180. uni.showModal({
  181. title: '提示',
  182. content: `确定要切换为${this.identity ? '团员' : '团长'}吗?`,
  183. confirmColor: '#019245',
  184. // cancelColor: '#FF2A2A',
  185. success: (res) => {
  186. if (res.confirm){
  187. // 这里的切换逻辑
  188. uni.showLoading({
  189. title: '切换中...'
  190. })
  191. setTimeout(() => {
  192. uni.hideLoading();
  193. this.identity = this.identity ? 0 : 1;
  194. uni.setStorageSync('identity', this.identity)
  195. uni.showToast({
  196. title: '切换成功',
  197. icon: 'success',
  198. duration: 2000
  199. })
  200. }, 500);
  201. }
  202. }
  203. })
  204. }
  205. },
  206. onLoad() {
  207. this.$store.commit('getUserInfo')
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. .center-page {
  213. // min-height: 100vh;
  214. background-color: #f5f5f5;
  215. padding-bottom: 120rpx;
  216. }
  217. .header {
  218. position: relative;
  219. height: 340rpx;
  220. background-size: cover;
  221. background-position: center;
  222. color: #fff;
  223. padding: 60rpx 30rpx 0;
  224. display: flex;
  225. flex-direction: column;
  226. align-items: start;
  227. position: relative;
  228. .user-info {
  229. position: absolute;
  230. display: flex;
  231. align-items: center;
  232. margin-top: 30rpx;
  233. z-index: 2;
  234. left: 30rpx;
  235. top: 120rpx;
  236. .avatar {
  237. width: 110rpx;
  238. height: 110rpx;
  239. border-radius: 50%;
  240. }
  241. .user-name-id {
  242. margin-left: 30rpx;
  243. display: flex;
  244. flex-direction: column;
  245. .user-name {
  246. font-size: 32rpx;
  247. font-weight: bold;
  248. margin-bottom: 6rpx;
  249. }
  250. .user-id {
  251. font-size: 24rpx;
  252. opacity: 0.9;
  253. }
  254. }
  255. }
  256. .role-switch-btn {
  257. position: absolute;
  258. right: 0;
  259. top: 180rpx;
  260. background-color: rgba(255, 255, 255, 0.2);
  261. border-radius: 30rpx 0 0 30rpx;
  262. padding: 10rpx 20rpx;
  263. font-size: 24rpx;
  264. z-index: 2;
  265. display: flex;
  266. align-items: center;
  267. }
  268. }
  269. .orders-section {
  270. background-color: #fff;
  271. border-radius: 20rpx 20rpx 0 0;
  272. margin: -70rpx auto 0;
  273. padding: 15rpx;
  274. position: relative;
  275. z-index: 3;
  276. width: 90%;
  277. // margin: 0 auto;
  278. }
  279. .member-functions {
  280. background-color: #fff;
  281. padding: 30rpx;
  282. margin-top: 20rpx;
  283. width: 88%;
  284. border-radius: 20rpx;
  285. margin: 30rpx auto 0;
  286. }
  287. .section-header {
  288. display: flex;
  289. justify-content: space-between;
  290. align-items: center;
  291. margin-bottom: 40rpx;
  292. .section-title {
  293. font-size: 32rpx;
  294. font-weight: 500;
  295. position: relative;
  296. padding-left: 15rpx;
  297. }
  298. .view-all {
  299. display: flex;
  300. align-items: center;
  301. font-size: 26rpx;
  302. color: $uni-color-third;
  303. }
  304. }
  305. .order-types {
  306. // background-color: red;
  307. display: flex;
  308. justify-content: space-around;
  309. .order-type-item {
  310. display: flex;
  311. flex-direction: column;
  312. align-items: center;
  313. // width: 20%;
  314. .order-icon-wrapper {
  315. position: relative;
  316. margin-bottom: 4rpx;
  317. .green-circle {
  318. width: 70rpx;
  319. height: 70rpx;
  320. background-color: $uni-color;
  321. border-radius: 50%;
  322. display: flex;
  323. justify-content: center;
  324. align-items: center;
  325. }
  326. }
  327. .order-type-text {
  328. font-size: 26rpx;
  329. color: #666;
  330. margin-top: 8rpx;
  331. }
  332. }
  333. }
  334. .function-grid {
  335. display: flex;
  336. flex-wrap: wrap;
  337. .function-item {
  338. width: 25%;
  339. display: flex;
  340. flex-direction: column;
  341. align-items: center;
  342. margin-bottom: 40rpx;
  343. .function-icon {
  344. width: 80rpx;
  345. height: 80rpx;
  346. display: flex;
  347. justify-content: center;
  348. align-items: center;
  349. margin-bottom: 16rpx;
  350. }
  351. .function-text {
  352. font-size: 26rpx;
  353. color: #333;
  354. }
  355. }
  356. }
  357. </style>