index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <view class="work-pages">
  3. <!-- 工作控制按钮及进度 -->
  4. <view class="work-cons flex-center">
  5. <!-- 操作按钮组件 -->
  6. <view class="work-button-wrap">
  7. <!-- 按钮 -->
  8. <view class="work-button flex-center" @click="startWork">
  9. <!-- 扇形进度条 -->
  10. <view class="circle_process">
  11. <view class="wrapper right"><view class="circle rightcircle" :style="{ transform: `rotate(${rdeg}deg)` }"></view></view>
  12. <view class="wrapper left"><view class="circle leftcircle" :style="{ transform: `rotate(${ldeg}deg)` }"></view></view>
  13. </view>
  14. <view class="cirle-one"></view>
  15. <!-- 指针 -->
  16. <view class="cirle-two flex-center" v-for="item in 60" :key="item">
  17. <view class="sector" :style="{ transform: `rotate(${item * 6}deg)` }"></view>
  18. </view>
  19. <view class="cirle-three flex-center"></view>
  20. <view class="cirle-free" :class="status == 'working' ? 'w-stop' : 'w-start'"></view>
  21. <view class="cirle-sex flex-center">{{ status == 'working' ? '紧急停止' : '点击启动' }}</view>
  22. </view>
  23. <!-- 状态提示 -->
  24. <view class="work-button-tips">设备准备就绪</view>
  25. </view>
  26. </view>
  27. <!-- 说明提示 -->
  28. <view class="work-tips">
  29. <view class="work-dtime">
  30. 距离订单强制完成还剩
  31. <u-count-down
  32. @change="changeDtime"
  33. separator="zh"
  34. font-size="36"
  35. separator-size="28"
  36. color="#ff0000"
  37. :timestamp="timestamp"
  38. :show-days="false"
  39. :show-hours="false"
  40. ></u-count-down>
  41. </view>
  42. <view class="work-remarks">
  43. <view class="title">说明:</view>
  44. <view>
  45. 支付完成后
  46. <text class="red">请尽快启动洗车服务</text>
  47. ,否则订单将在5分钟后自动完成。
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 正在启动,归位弹框提示 -->
  52. <u-popup v-model="showStart" :mask-close-able="false" border-radius="10" mode="center" width="500rpx" height="400rpx">
  53. <view style="padding: 30rpx;display: flex;justify-content: center;text-align: center;">
  54. <!-- 启动中 -->
  55. <view v-if="status == 'start'">
  56. <u-image width="216px" height="120px" src="/static/img/start.png"></u-image>
  57. <view style="padding: 15rpx;">洗车机正在启动...</view>
  58. </view>
  59. <!-- 归位中 -->
  60. <view v-if="status == 'reseting'">
  61. <u-image width="216px" height="120px" src="/static/img/reset.png"></u-image>
  62. <view style="padding: 15rpx;">洗车机正在归位中...</view>
  63. </view>
  64. </view>
  65. </u-popup>
  66. <!-- 急停提示弹框 -->
  67. <u-popup v-model="showStop" :mask-close-able="false" border-radius="10" mode="center" width="80%">
  68. <view style="padding: 30rpx;text-align: center;">
  69. <view>
  70. <view style="font-weight: bold;">设备提示</view>
  71. <view style="display: flex;justify-content: center;padding: 10rpx 0;">
  72. <u-image width="165px" height="138px" src="/static/img/sbts.png"></u-image>
  73. </view>
  74. <u-divider>可能原因</u-divider>
  75. <view style="padding: 15rpx;text-align: left;">
  76. <view>1、洗车机紧急停止,本次服务结束</view>
  77. <view>2、因设备故障无法继续为您服务,所支付金额将退至您的支付账户</view>
  78. <view>3、如需再次服务,请退出车辆重新进入,再扫码支付洗车</view>
  79. <view>4、如需帮助请联系客服</view>
  80. </view>
  81. <view style="display: flex;padding: 20rpx 0;">
  82. <u-button @click="callPhone" style="width: 45%;border-radius: 0;">联系客服</u-button>
  83. <u-button @click="resetRabt" style="width: 45%;" type="error">洗车机归位</u-button>
  84. </view>
  85. </view>
  86. </view>
  87. </u-popup>
  88. </view>
  89. </template>
  90. <script>
  91. export default {
  92. data() {
  93. return {
  94. timestamp: 300,
  95. rdeg: -135,
  96. ldeg: -135,
  97. step: 0,
  98. interId: null,
  99. status: 'start', // 状态,start 开始启动,working 正在工作,reseting 归位中
  100. showStart: false ,// 启动弹框提示
  101. showStop: false, // 急停提示
  102. };
  103. },
  104. onLoad() {},
  105. methods: {
  106. // 电话客服
  107. callPhone () {
  108. uni.makePhoneCall({
  109. phoneNumber: '114'
  110. })
  111. },
  112. // 倒计时监听,0 时自动结束订单
  113. changeDtime(time) {
  114. console.log(time);
  115. },
  116. // 归位机器
  117. resetRabt(){
  118. this.status = 'reseting';
  119. this.showStart = true;
  120. this.showStop = false;
  121. // 归位结束后
  122. setTimeout(()=>{
  123. uni.redirectTo({
  124. url:"/pages/work/success/success"
  125. })
  126. },3000)
  127. },
  128. // 启动,急停按钮
  129. startWork() {
  130. // 启动
  131. if (this.status == 'start') {
  132. this.showStart = true;
  133. // 启动成功
  134. setTimeout(() => {
  135. this.status = 'working';
  136. this.showStart = false;
  137. // 进度条
  138. this.interId = setInterval(()=>{
  139. this.loading(this.step++)
  140. },1000)
  141. }, 3000);
  142. }
  143. // 急停
  144. if (this.status == 'working') {
  145. // 显示急停提示弹框
  146. this.showStop = true;
  147. // 停止进度
  148. this.rdeg= -135;
  149. this.ldeg= -135;
  150. clearInterval(this.interId);
  151. }
  152. },
  153. // 进度条动画
  154. loading(second) {
  155. if (second <= 30) {
  156. this.rdeg = -135 + 6 * second;
  157. this.ldeg = -135;
  158. } else {
  159. this.rdeg = 45;
  160. this.ldeg = -135 + 6 * (second - 30);
  161. }
  162. }
  163. }
  164. };
  165. </script>
  166. <style lang="scss">
  167. // 扇形圆环
  168. .circle_process {
  169. position: absolute;
  170. width: 390rpx;
  171. height: 390rpx;
  172. }
  173. .circle_process .wrapper {
  174. width: 195rpx;
  175. height: 390rpx;
  176. position: absolute;
  177. top: 0;
  178. overflow: hidden;
  179. }
  180. .circle_process .right {
  181. right: 1px;
  182. }
  183. .circle_process .left {
  184. left: 1px;
  185. }
  186. .circle_process .circle {
  187. width: 390rpx;
  188. height: 390rpx;
  189. border: 40rpx solid transparent;
  190. border-radius: 100%;
  191. position: absolute;
  192. top: 0;
  193. transform: rotate(-135deg);
  194. }
  195. .circle_process .rightcircle {
  196. border-top: 40rpx solid red;
  197. border-right: 40rpx solid red;
  198. right: 0;
  199. }
  200. .circle_process .leftcircle {
  201. border-bottom: 40rpx solid red;
  202. border-left: 40rpx solid red;
  203. left: 0;
  204. }
  205. .work-pages {
  206. width: 100%;
  207. .flex-center {
  208. display: flex;
  209. align-items: center;
  210. justify-content: center;
  211. }
  212. .work-cons {
  213. height: 50vh;
  214. background-image: linear-gradient(0deg, #666, #333);
  215. border-bottom-left-radius: 500rpx 50rpx;
  216. border-bottom-right-radius: 500rpx 50rpx;
  217. position: relative;
  218. // 按钮
  219. .work-button-wrap {
  220. width: 400rpx;
  221. margin-top: -50rpx;
  222. .work-button {
  223. background: #666;
  224. border-radius: 100%;
  225. width: 390rpx;
  226. height: 390rpx;
  227. cursor: pointer;
  228. .cirle-one {
  229. background-image: linear-gradient(180deg, #555, #333 20%);
  230. width: 370rpx;
  231. height: 370rpx;
  232. border-radius: 100%;
  233. position: absolute;
  234. }
  235. .cirle-two {
  236. width: 370rpx;
  237. height: 370rpx;
  238. border-radius: 100%;
  239. position: absolute;
  240. .sector {
  241. transform-origin: center center;
  242. width: 350rpx;
  243. height: 5rpx;
  244. background: #888;
  245. }
  246. }
  247. .cirle-three {
  248. background: #444;
  249. width: 280rpx;
  250. height: 280rpx;
  251. border-radius: 100%;
  252. position: absolute;
  253. }
  254. .cirle-free {
  255. width: 230rpx;
  256. height: 230rpx;
  257. border-radius: 100%;
  258. position: absolute;
  259. animation: mymove 5s infinite;
  260. }
  261. @keyframes mymove {
  262. 0% {
  263. transform: scale(1); /*开始为原始大小*/
  264. opacity: 1;
  265. }
  266. 25% {
  267. transform: scale(1.1); /*放大1.1倍*/
  268. opacity: 0.5;
  269. }
  270. 50% {
  271. transform: scale(1);
  272. opacity: 1;
  273. }
  274. 75% {
  275. transform: scale(1.1);
  276. opacity: 0.5;
  277. }
  278. }
  279. .cirle-sex {
  280. background-image: linear-gradient(180deg, #888, #333 50%);
  281. width: 210rpx;
  282. height: 210rpx;
  283. border-radius: 100%;
  284. position: absolute;
  285. color: #ffffff;
  286. font-size: 28rpx;
  287. color: #eee;
  288. }
  289. .w-start {
  290. background: #ffc800;
  291. }
  292. .w-stop {
  293. background: #ff0000;
  294. }
  295. &:active {
  296. .cirle-sex {
  297. background-image: linear-gradient(180deg, #888, #333 80%);
  298. }
  299. }
  300. }
  301. .work-button-tips {
  302. color: #eee;
  303. text-align: center;
  304. padding-top: 30rpx;
  305. }
  306. }
  307. }
  308. .work-tips {
  309. padding: 45rpx;
  310. .work-dtime {
  311. text-align: center;
  312. font-weight: bold;
  313. font-size: 34rpx;
  314. }
  315. .work-remarks {
  316. padding-top: 50rpx;
  317. .red {
  318. color: red;
  319. }
  320. .title {
  321. font-weight: bold;
  322. }
  323. }
  324. }
  325. }
  326. </style>