work-status.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view class="container">
  3. <!-- 挂牌看板区域 -->
  4. <view class="signboard-container">
  5. <view class="rope"></view>
  6. <view class="nail"></view>
  7. <view class="board" :class="{ 'resting': status === 'resting' }">
  8. <view class="screw top-left"></view>
  9. <view class="screw top-right"></view>
  10. <view class="screw bottom-left"></view>
  11. <view class="screw bottom-right"></view>
  12. <view class="board-inner">
  13. <text class="status-text">{{ status === 'working' ? '接单中' : '休息中' }}</text>
  14. </view>
  15. </view>
  16. </view>
  17. <!-- 状态描述 -->
  18. <view class="status-desc">
  19. <text>{{ status === 'working' ? '当前处于工作接单中,正常接收新订单' : '当前处于休息状态,暂停接收新订单' }}</text>
  20. </view>
  21. <!-- 操作按钮 -->
  22. <view class="action-area">
  23. <button class="action-btn" :class="{ 'stop': status === 'working', 'stopped': status === 'resting' }" @click="toggleStatus">
  24. {{ status === 'working' ? '停止接单' : '已停止接单' }}
  25. </button>
  26. <view class="tips">
  27. <text v-if="status === 'working'">当您希望长时间不再接收订单时,请点击上方按钮停止接单,开启后需手动恢复。</text>
  28. <text v-else>点击上方按钮恢复接单,开始接收新的任务推送。</text>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. status: 'working' // working | resting
  38. }
  39. },
  40. onShow() {
  41. // 从本地存储获取状态
  42. const savedStatus = uni.getStorageSync('workStatus');
  43. if (savedStatus) {
  44. this.status = savedStatus;
  45. }
  46. },
  47. methods: {
  48. toggleStatus() {
  49. if (this.status === 'working') {
  50. // 切换到休息
  51. this.status = 'resting';
  52. uni.setStorageSync('workStatus', 'resting');
  53. // 图3显示依然有按钮只是置灰,或者变为"已停止接单"
  54. } else {
  55. // 切换回接单
  56. this.status = 'working';
  57. uni.setStorageSync('workStatus', 'working');
  58. }
  59. }
  60. }
  61. }
  62. </script>
  63. <style>
  64. page {
  65. background-color: #fff;
  66. }
  67. .container {
  68. display: flex;
  69. flex-direction: column;
  70. align-items: center;
  71. padding-top: 100rpx;
  72. }
  73. /* 挂牌动画区域 */
  74. .signboard-container {
  75. position: relative;
  76. width: 400rpx;
  77. height: 300rpx;
  78. display: flex;
  79. justify-content: center;
  80. margin-bottom: 60rpx;
  81. }
  82. .rope {
  83. position: absolute;
  84. top: 0;
  85. width: 200rpx;
  86. height: 100rpx;
  87. border-top: 4rpx solid #FFC107; /* Yellow rope */
  88. border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  89. z-index: 1;
  90. }
  91. .nail {
  92. position: absolute;
  93. top: -10rpx;
  94. width: 24rpx;
  95. height: 24rpx;
  96. background-color: #FFC107;
  97. border-radius: 50%;
  98. z-index: 2;
  99. box-shadow: 0 2rpx 4rpx rgba(0,0,0,0.2);
  100. }
  101. .board {
  102. position: absolute;
  103. top: 80rpx;
  104. width: 360rpx;
  105. height: 200rpx;
  106. background-color: #FF7043; /* Orange for working */
  107. border-radius: 20rpx;
  108. display: flex;
  109. justify-content: center;
  110. align-items: center;
  111. box-shadow: 0 10rpx 0 #E64A19;
  112. transition: all 0.3s;
  113. }
  114. .board.resting {
  115. background-color: #BDBDBD; /* Gray for resting */
  116. box-shadow: 0 10rpx 0 #9E9E9E;
  117. }
  118. .board-inner {
  119. width: 280rpx;
  120. height: 120rpx;
  121. background-color: #fff;
  122. border-radius: 10rpx;
  123. display: flex;
  124. justify-content: center;
  125. align-items: center;
  126. transform: rotate(-2deg); /* Slightly tilted inner paper */
  127. }
  128. .status-text {
  129. font-size: 48rpx;
  130. font-weight: bold;
  131. color: #FF5722;
  132. }
  133. .board.resting .status-text {
  134. color: #757575;
  135. }
  136. .screw {
  137. position: absolute;
  138. width: 16rpx;
  139. height: 16rpx;
  140. background-color: #fff;
  141. border-radius: 50%;
  142. opacity: 0.8;
  143. }
  144. .top-left { top: 20rpx; left: 20rpx; }
  145. .top-right { top: 20rpx; right: 20rpx; }
  146. .bottom-left { bottom: 20rpx; left: 20rpx; }
  147. .bottom-right { bottom: 20rpx; right: 20rpx; }
  148. /* 文本描述 */
  149. .status-desc {
  150. margin-bottom: 100rpx;
  151. color: #333;
  152. font-size: 30rpx;
  153. font-weight: 500;
  154. }
  155. /* 按钮区域 */
  156. .action-area {
  157. width: 80%;
  158. display: flex;
  159. flex-direction: column;
  160. align-items: center;
  161. }
  162. .action-btn {
  163. width: 100%;
  164. height: 88rpx;
  165. line-height: 88rpx;
  166. border-radius: 44rpx;
  167. color: #fff;
  168. font-size: 32rpx;
  169. font-weight: bold;
  170. margin-bottom: 30rpx;
  171. border: none;
  172. }
  173. .action-btn::after { border: none; }
  174. .action-btn.stop {
  175. background: linear-gradient(90deg, #FF9800 0%, #FF5722 100%);
  176. box-shadow: 0 10rpx 20rpx rgba(255, 87, 34, 0.3);
  177. }
  178. .action-btn.stopped {
  179. background-color: #E0E0E0;
  180. color: #999;
  181. box-shadow: none;
  182. }
  183. .tips {
  184. font-size: 24rpx;
  185. color: #999;
  186. text-align: center;
  187. line-height: 1.5;
  188. }
  189. </style>