edit.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <scroller>
  3. <div class="box">
  4. <title>预约信息</title>
  5. <div class="my-order-body">
  6. <div><span class="title">创建日期:</span>{{order.time}}</div>
  7. <div><span class="title">用户姓名:</span>{{order.user_name}}</div>
  8. <div><span class="title">用户手机:</span><a id='tel' v-bind:href='`tel:${order.mobile}`'>{{order.mobile}}</a></div>
  9. <div><span class="title">服务地址:</span>{{order.address}}</div>
  10. <div class="stroe"><span class="title">门店:</span><span>
  11. {{storeName}}({{storeAddress}})<br>门店电话:<a id='tel' v-bind:href='`tel:${storeMobile}`'>{{storeMobile}}</a>
  12. </span></div>
  13. <div><span class="title">服务类型:</span>{{order.type_str}}</div>
  14. <div v-if='order.type -1 == 0'><span
  15. class="title">服务时间:</span>{{order.server_start_time}} ~ {{order.server_end_time}}
  16. </div>
  17. <div v-if='order.type -1 == 0'><span class="title">服务形式:</span>{{order.cart_str}}</div>
  18. <div v-if='order.type -1 == 0'><span class="title">服务技能:</span>{{skillStr}}</div>
  19. <div v-if='order.type - 1 == 1'><span class="title">预产期:</span>{{order.yc_time}}</div>
  20. <div v-if='order.type -1 == 2'><span class="title">孩子年龄:</span>{{order.age}}岁</div>
  21. <!--showContract btnContract-->
  22. <div v-if="order.status === 3 && order.contract === 2"><span class="title">签约状态:</span>{{order.contract_str}}
  23. </div>
  24. <!--<div v-if="showContract"><span class="title">签约状态:</span><span @click='btnContract'>{{contractStr}}</span></div>-->
  25. <!--预约日期-->
  26. <div v-if="showStatus">
  27. <!--选择时间-->
  28. <datetime v-model="bookingTime" format="YYYY-MM-DD HH:00"
  29. @on-change="change" :title="('预约日期:')" year-row="{value}年" month-row="{value}月" day-row="{value}日"
  30. hour-row="{value}点" minute-row="{value}分" confirm-text="完成" cancel-text="取消"
  31. :start-date='startDate'
  32. placeholder="请选择日期"
  33. :end-date='endDate' :min-hour=9 :max-hour=18></datetime>
  34. </div>
  35. <div v-if="!showStatus"><span class="title">预约日期:</span>{{order.status_time}}</div>
  36. <!--家政员-->
  37. <div v-if="showTech">
  38. <span class="title">家政员:</span><span><input v-model="tech" class="tech" type="text"
  39. placeholder='请输入家政员'></span>
  40. </div>
  41. <div v-if="order.status !== 3 && order.contract !== 2">
  42. <span class="title">家政员电话:</span><span><input v-model="techMobile" class="tech" type="text"
  43. placeholder='请输入家政员电话'></span>
  44. </div>
  45. <div v-if='!showTech'><span class="title">家政员:</span>{{order.tech}}</div>
  46. <div v-if="order.status === 3"><span class="title">家政员电话:</span><span>{{order.tech_mobile}}</span></div>
  47. <!--面试状态-->
  48. <!--<div class="weui-cell" v-if="order.status == 2">-->
  49. <!--<div class="weui-cell__hd"><label class="weui-label">面试状态</label></div>-->
  50. <!--<div class="weui-cell__bd" @click='btnServiceForm'>-->
  51. <!--<input class="weui-input select-time" type="button" required=""-->
  52. <!--:value="serviceForm">-->
  53. <!--</div>-->
  54. <!--<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>-->
  55. <!--</div>-->
  56. <div v-if="order.status == 2">
  57. <span class="title">面试状态:</span>
  58. <span style="margin-left: -4px;" @click="btnServiceForm">{{serviceForm}}</span>
  59. </div>
  60. <div><span class="title">备注:</span>{{order.desc}}</div>
  61. </div>
  62. <div v-if="btnSubmintStrShow" class="m-btn">
  63. <x-button type="primary" @click.native='btnSubmint'>{{btnSubmintStr}}</x-button>
  64. </div>
  65. </div>
  66. </scroller>
  67. </template>
  68. <script>
  69. import _ from '@/config'
  70. import selectTime from '@/config/selectTime'
  71. import axios from 'axios'
  72. import {Group, Datetime, XButton} from 'vux'
  73. export default {
  74. name: 'orderInfo',
  75. data() {
  76. return {
  77. type: {0: '钟点工', 1: '月嫂', 2: '育婴师', 3: '护理老人', 4: '全套家务'},
  78. serviceArr: [
  79. {label: '未面试', value: 1},
  80. {label: '已面试', value: 2}
  81. ],
  82. serviceForm: '未面试',
  83. resServiceArr: 1,
  84. order: {},
  85. eAppointmentDate: false,
  86. monthArr: {},
  87. skillStr: '', // 服务技能
  88. bookingTime: '', // 服务时间
  89. value: ['2017-06-24', '03', '05'], // 设定日期格式
  90. startDate: selectTime.startDate, // 限定最小日期
  91. endDate: '', // 限定最大日期
  92. tech: '',
  93. techMobile: '',
  94. storeStr: '',
  95. storeName: '',
  96. storeAddress: '',
  97. storeMobile: '',
  98. showTech: false, // 家政员
  99. showContract: false, // 签约状态
  100. contractStr: '未签约',
  101. contractStrArr: [],
  102. btnSubmintStr: '已预约',
  103. btnSubmintStrShow: true,
  104. showStatus: false // 预约状态
  105. }
  106. },
  107. created() {
  108. let that = this;
  109. axios.post(_.apiPath + 'j/HouseKeeping/GetStore').then(res => {
  110. for (let i in res.data) {
  111. if (res.data[i].store_id == _.oldOrderInfo.store_id) {
  112. that.storeName = res.data[i].store_name;
  113. that.storeAddress = res.data[i].address;
  114. that.storeMobile = res.data[i].mobile
  115. }
  116. }
  117. })
  118. if (_.oldOrderInfo === undefined) {
  119. this.$router.push({path: '/managementList'})
  120. }
  121. this.order = _.oldOrderInfo;
  122. // 状态编辑
  123. // 已面试
  124. if (that.order.contract === 1 && that.order.status === 2) {
  125. that.btnSubmintStr = '提交'
  126. }
  127. // 已签约
  128. if (that.order.contract === 1 && that.order.status === 3) {
  129. that.btnSubmintStr = '已签约'
  130. }
  131. // 已完成
  132. if (that.order.contract === 2 && that.order.status === 3) {
  133. that.btnSubmintStrShow = false
  134. }
  135. // 预约时间
  136. console.log(that.order);
  137. if (that.order.status_time !== 0) {
  138. that.bookingTime = that.order.status_time
  139. }
  140. // 家政员
  141. if (that.order.tech.length > 0) {
  142. that.tech = that.order.tech;
  143. }
  144. // 家政员电话
  145. if (that.order.tech_mobile !== '') {
  146. that.techMobile = that.order.tech_mobile;
  147. }
  148. // 转化时间格式
  149. // this.order.yc_time = _.timetrans(this.order.yc_time); // 预产期
  150. this.order.yc_time = this.order.yc_time.substring(0, 10); // 预产期
  151. this.order.server_start_time = _.timetrans(this.order.server_start_time);
  152. this.order.server_start_time = this.order.server_start_time.substring(11, 16);
  153. this.order.server_end_time = _.timetrans(this.order.server_end_time);
  154. this.order.server_end_time = this.order.server_end_time.substring(11, 16);
  155. if (this.order.status - 1 == 0) {
  156. this.eAppointmentDate = true
  157. }
  158. if (this.order.status !== 3) {
  159. this.showStatus = true;
  160. this.showTech = true;
  161. }
  162. if (this.order.contract == 1 && this.order.status == 2) {
  163. this.showContract = true;
  164. }
  165. for (let i in this.order.skill_str) {
  166. this.skillStr = `${this.skillStr} ${this.order.skill_str[i]}`
  167. }
  168. },
  169. components: {
  170. Group,
  171. Datetime,
  172. XButton
  173. },
  174. methods: {
  175. btnSubmint() {
  176. let that = this;
  177. // 预约日期判断
  178. if (that.bookingTime == '') {
  179. weui.alert('请选择预约日期');
  180. return
  181. }
  182. // 家政员不为空判断
  183. if (that.tech.length == '') {
  184. weui.alert('请输入家政员');
  185. return
  186. }
  187. // 家政员电话不为空判断
  188. if (that.techMobile.length == '') {
  189. weui.alert('请输入家政员电话');
  190. return
  191. }
  192. // 预约中
  193. if (that.order.contract == 1 && that.order.status == 1) {
  194. let stitching = `&id=${_.oldOrderInfo.id}&status=2&status_time=${ycTime(that.bookingTime)}&tech=${that.tech}&tech_mobile=${that.techMobile}`;
  195. axios.post(_.apiPath + 'j/HouseKeeping/Edit' + stitching).then(res => {
  196. if (res.data.success) {
  197. weui.alert('提交成功', function () {
  198. that.$router.push({path: '/managementList'});
  199. });
  200. return
  201. } else {
  202. weui.alert('提交失败');
  203. return
  204. }
  205. })
  206. return;
  207. }
  208. // 已面试
  209. if (that.order.contract == 1 && that.order.status == 2) {
  210. // 用户不想进入已面试阶段
  211. if (that.resServiceArr === 1) {
  212. let stitching = `&id=${_.oldOrderInfo.id}&contract=1&status=2&status_time=${ycTime(that.bookingTime)}&tech=${that.tech}&tech_mobile=${that.techMobile}`;
  213. axios.post(_.apiPath + 'j/HouseKeeping/Edit' + stitching).then(res => {
  214. statusF(res.data.success);
  215. return;
  216. })
  217. // 用户想进入已面试阶段
  218. } else {
  219. that.$vux.confirm.show({
  220. title: '提示',
  221. content: '请确定,家政员是否已面试',
  222. // 组件除show外的属性
  223. onCancel() {
  224. },
  225. onConfirm() {
  226. let stitching = `&id=${_.oldOrderInfo.id}&contract=1&status=3&status_time=${ycTime(that.bookingTime)}&tech=${that.tech}`;
  227. axios.post(_.apiPath + 'j/HouseKeeping/Edit' + stitching).then(res => {
  228. statusF(res.data.success);
  229. return;
  230. })
  231. }
  232. })
  233. }
  234. }
  235. // 已签约
  236. if (that.order.contract == 1 && that.order.status == 3) {
  237. that.$vux.confirm.show({
  238. title: '提示',
  239. content: '请确定,家政员是否已签约',
  240. // 组件除show外的属性
  241. onCancel() {
  242. },
  243. onConfirm() {
  244. let stitching = `&id=${_.oldOrderInfo.id}&contract=2`;
  245. axios.post(_.apiPath + 'j/HouseKeeping/Edit' + stitching).then(res => {
  246. statusF(res.data.success);
  247. return;
  248. })
  249. }
  250. })
  251. }
  252. // 提交返回状态
  253. function statusF(s) {
  254. if (s) {
  255. that.$vux.alert.show({
  256. title: '提示',
  257. content: '提交成功!',
  258. onShow() {
  259. // console.log('Plugin: I\'m showing')
  260. },
  261. onHide() {
  262. that.$router.push({path: '/managementList'});
  263. return;
  264. }
  265. })
  266. } else {
  267. that.$vux.alert.show({
  268. title: '提示',
  269. content: '提交失败!请稍后再试。',
  270. onShow() {
  271. },
  272. onHide() {
  273. that.$router.push({path: '/managementList'});
  274. }
  275. })
  276. }
  277. }
  278. },
  279. change(val) {
  280. this.bookingTime = val;
  281. },
  282. btnServiceForm() {
  283. let that = this;
  284. weui.picker(that.serviceArr, {
  285. className: 'custom-classname',
  286. container: 'body',
  287. defaultValue: [1],
  288. onChange: function (result) {
  289. },
  290. onConfirm: function (result) {
  291. that.serviceForm = result[0].label;
  292. that.resServiceArr = result[0].value;
  293. },
  294. id: 'singleLinePicker'
  295. });
  296. },
  297. },
  298. watch: {
  299. order: function (val, oldVal) {
  300. if (val == undefined) {
  301. this.$router.push({path: '/order'})
  302. }
  303. }
  304. }
  305. }
  306. // 日期转时间戳 2014-07-10
  307. function ycTime(t) {
  308. let stringTime = t + ':00';
  309. let timestamp = Date.parse(new Date(stringTime));
  310. timestamp = timestamp / 1000;
  311. return timestamp;
  312. }
  313. </script>
  314. <style scoped lang="less">
  315. .weui-cell {
  316. padding: 0 15px 0 0 !important;
  317. }
  318. title {
  319. display: block;
  320. padding: 15px 0;
  321. font-size: 30px;
  322. font-weight: 900;
  323. text-align: center;
  324. }
  325. .my-order-body {
  326. border-top: 1px solid rgba(0, 0, 0, 0.1);
  327. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  328. padding-left: 15px;
  329. & > div {
  330. font-size: 13px;
  331. padding: 5px 0;
  332. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  333. &:last-child {
  334. border-bottom: 0;
  335. }
  336. & > span:nth-child(1) {
  337. width: 25%;
  338. display: inline-block;
  339. margin-right: 20px;
  340. }
  341. & > span:nth-child(2) {
  342. width: 60%;
  343. display: inline-block;
  344. }
  345. }
  346. }
  347. .stroe {
  348. display: flex;
  349. flex-direction: row;
  350. }
  351. .tech, .tech:focus {
  352. border: 0;
  353. outline: none
  354. }
  355. .m-btn {
  356. width: 80%;
  357. margin: 10% auto 0;
  358. }
  359. p {
  360. color: #2c3e50 !important;
  361. font-size: 15px !important;
  362. }
  363. </style>