index.vue 8.1 KB

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