tenancyRepairOrder.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <template>
  2. <zj-page-layout :hasFooter="true">
  3. <view class="all-container">
  4. <view class="address-container card">
  5. <view class="main">
  6. <view class="left">
  7. <view class="icon"><text class="iconfont icon-dingwei1"></text></view>
  8. <view class="hasdata">
  9. <view class="name">{{addressInfo.name}}<text>{{addressInfo.phone}}</text></view>
  10. <view class="address ellipsis-2">
  11. {{addressInfo.province}}{{addressInfo.city}}{{addressInfo.area}}{{addressInfo.street}}{{addressInfo.address}}{{addressInfo.houseNo}}
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="card service-container">
  18. <view class="common-title">服务信息</view>
  19. <view class="item">
  20. <view class="label"><text>*</text>工单类型</view>
  21. <view class="value">报修单</view>
  22. </view>
  23. <view class="item">
  24. <view class="label"><text>*</text>预约上门时间</view>
  25. <view class="picker" @tap="isShowDate = true">
  26. <text class="value" v-if="endDate">{{endDate}}</text>
  27. <text class="placeholder" v-else>请选择</text>
  28. <text class="iconfont icon-jinru"></text>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="card goods">
  33. <view class="common-title">产品信息</view>
  34. <view class="item">
  35. <image :src="product.categoryUrl" mode="aspectFill"></image>
  36. <view class="right">
  37. <view class="name">{{product.goodsLeaseName}}</view>
  38. <view class="name remark">{{product.repairRemark}}</view>
  39. </view>
  40. </view>
  41. <view class="items">
  42. <view class="label">下单日期</view>
  43. <view class="value">{{detail.createTime}}</view>
  44. </view>
  45. <view class="items">
  46. <view class="label">租赁时间</view>
  47. <view class="value">{{product.startDate.substring(0,10) + ' 至 ' + product.endDate.substring(0,10)}}</view>
  48. </view>
  49. </view>
  50. <view class="card service-container">
  51. <view class="common-title">备注信息</view>
  52. <u--textarea v-model="remark" placeholder="请输入内容" border="none" autoHeight></u--textarea>
  53. </view>
  54. </view>
  55. <view class="footer">
  56. <u-button text="提交服务单" shape="circle" color="#428dff" type="primary" @click="submitData"></u-button>
  57. </view>
  58. <!-- <zjDialogDatePicker :value="isShowDate" @cancel="cancelDate()"></zjDialogDatePicker> -->
  59. <u-datetime-picker
  60. :show="isShowDate"
  61. v-model="datePickerValue"
  62. mode="date"
  63. :formatter="formatter"
  64. @cancel="isShowDate = false"
  65. @close="isShowDate = false"
  66. @confirm="confirmDate"
  67. :minDate="minDate"
  68. ></u-datetime-picker>
  69. </zj-page-layout>
  70. </template>
  71. <script>
  72. import { weixinPay, mini_env } from '@/common/utils/util.js';
  73. import zjDialogDatePicker from '@/components/zj-dialog/zj-dialog-datePicker.vue';
  74. export default {
  75. components: {
  76. zjDialogDatePicker
  77. },
  78. data() {
  79. return {
  80. detail: {},
  81. addressInfo: null,
  82. isShowDate: false,
  83. is_confirm: true,
  84. userInfo: {},
  85. endDate: '',
  86. qty: 1,
  87. payType: 'WECHAT',
  88. remark: '',
  89. typeId: '',
  90. datePickerValue: Number(new Date()),
  91. minDate: Number(new Date()),
  92. }
  93. },
  94. computed: {
  95. },
  96. async onLoad({id}) {
  97. this.id = id
  98. this.getTypeList()
  99. this.getDetail(id)
  100. // this.crossPage.$on('confirm', result => {
  101. // this.endDate = result.choosDate
  102. // this.isShowDate = false
  103. // })
  104. },
  105. onUnload() {
  106. this.crossPage.$off('chooseAddress');
  107. },
  108. methods: {
  109. formatter(type, value) {
  110. if (type === 'year') {
  111. return `${value}年`
  112. }
  113. if (type === 'month') {
  114. return `${value}月`
  115. }
  116. if (type === 'day') {
  117. return `${value}日`
  118. }
  119. return value
  120. },
  121. confirmDate(e) {
  122. this.isShowDate = false;
  123. let time = new Date(e.value);
  124. let y = time.getFullYear();
  125. let m = (time.getMonth()+1) < 10 ? '0' + (time.getMonth()+1) : time.getMonth()+1;
  126. let d = (time.getDate()) < 10 ? '0' + (time.getDate()) : time.getDate();
  127. let hh = (time.getHours()) < 10 ? '0' + (time.getHours()) : time.getHours();
  128. let mm = (time.getMinutes()) < 10 ? '0' + (time.getMinutes()) : time.getMinutes();
  129. let ss = (time.getSeconds()) < 10 ? '0' + (time.getSeconds()) : time.getSeconds();
  130. this.endDate = `${y}-${m}-${d}`;
  131. },
  132. // 获取品牌列表
  133. getDetail(id) {
  134. this.$api.post('/lease/order/detail',{
  135. id
  136. }).then(res => {
  137. this.getAddressData(res.data.userAddressId)
  138. this.detail = res.data;
  139. this.product = res.data.items[0]
  140. })
  141. },
  142. getTypeList(){
  143. this.$api.post('/pg/order/base/type/list').then(res => {
  144. res.data.forEach(item=>{
  145. if(item.orderType == 'REPAIR'){
  146. this.typeId = item.id
  147. }
  148. })
  149. })
  150. },
  151. // 获取地址信息
  152. getAddressData(userAddressId) {
  153. this.$api.get('/user/address/detail', {
  154. userAddressId
  155. }).then(res => {
  156. this.addressInfo = {
  157. name: res.data.name,
  158. phone: res.data.phone,
  159. province: res.data.province,
  160. city: res.data.city,
  161. area: res.data.area,
  162. street: res.data.street,
  163. address: res.data.address,
  164. houseNo: res.data.houseNo,
  165. defaultAddr: res.data.defaultAddr,
  166. }
  167. })
  168. },
  169. cancelDate(){
  170. this.isShowDate = false
  171. },
  172. // 去选择地址
  173. chooseAddress() {
  174. this.$navToPage({
  175. url: '/packageMine/pages/address/list?isChoose=' + true
  176. })
  177. },
  178. submitData() {
  179. let productList = [{
  180. mainId: this.product.categoryId,
  181. mainName: this.product.categoryName,
  182. num: this.product.qty,
  183. imgUrl: this.product.categoryUrl
  184. }]
  185. if (!this.endDate) return this.$toast('请选择预约上门时间');
  186. if (!this.is_confirm) { return this.$toast('请勿频繁点击!') }
  187. this.is_confirm = false
  188. setTimeout(() => {
  189. this.is_confirm = true
  190. }, 3000)
  191. this.$api.postJson('/pg/order/base/save', {
  192. orderSmallType: this.typeId,
  193. userAddressId: this.detail.userAddressId,
  194. saleOrderId: this.id,
  195. appointmentTime: this.endDate + ' 00:00:00',
  196. orderProducts: productList,
  197. remark: this.remark,
  198. isZl: true
  199. }).then(res => {
  200. this.$successToast();
  201. this.$navToPage({
  202. url: `/packageWorkorder/pages/userWorkorderList`
  203. })
  204. })
  205. },
  206. },
  207. }
  208. </script>
  209. <style lang="scss" scoped>
  210. .all-container{
  211. padding-bottom: 220rpx;
  212. box-sizing: border-box;
  213. }
  214. .card {
  215. @include zj-card;
  216. margin-top: 20rpx;
  217. padding: 30rpx;
  218. }
  219. .flex{
  220. display: flex;
  221. }
  222. .flex_asb{
  223. display: flex;
  224. justify-content: space-between;
  225. align-items: center;
  226. }
  227. .common-title {
  228. font-size: 32rpx;
  229. font-weight: 500;
  230. margin-bottom: 20rpx;
  231. text {
  232. color: $error-color;
  233. font-weight: normal;
  234. }
  235. }
  236. .all-container {
  237. padding: 0 20rpx;
  238. }
  239. .service-container {
  240. .item {
  241. display: flex;
  242. align-items: center;
  243. justify-content: space-between;
  244. height: 50rpx;
  245. margin-bottom: 30rpx;
  246. .label {
  247. margin-right: 30rpx;
  248. text {
  249. color: $error-color;
  250. }
  251. }
  252. .picker {
  253. .placeholder {
  254. color: $sec-font;
  255. }
  256. .iconfont {
  257. margin-left: 12rpx;
  258. color: $sec-font;
  259. }
  260. }
  261. }
  262. }
  263. .address-container {
  264. .main {
  265. display: flex;
  266. justify-content: space-between;
  267. align-items: center;
  268. margin-top: 30rpx;
  269. }
  270. .right {
  271. font-size: 32rpx;
  272. color: $sec-font;
  273. flex-shrink: 0;
  274. }
  275. .left {
  276. display: flex;
  277. align-items: center;
  278. margin-right: 20rpx;
  279. .icon {
  280. width: 52rpx;
  281. height: 52rpx;
  282. border-radius: 50%;
  283. background: $theme-color;
  284. display: flex;
  285. flex-shrink: 0;
  286. justify-content: center;
  287. align-items: center;
  288. margin-right: 20rpx;
  289. .iconfont {
  290. font-size: 36rpx;
  291. color: #ffffff;
  292. }
  293. }
  294. .nodata {
  295. font-size: 28rpx;
  296. color: #999999;
  297. }
  298. .hasdata {
  299. .name {
  300. font-size: 32rpx;
  301. color: #333333;
  302. text {
  303. color: #999999;
  304. font-size: 28rpx;
  305. margin-left: 16rpx;
  306. }
  307. }
  308. .address {
  309. font-size: 28rpx;
  310. color: #666666;
  311. line-height: 34rpx;
  312. margin-top: 10rpx;
  313. }
  314. }
  315. }
  316. }
  317. .goods{
  318. .item{
  319. display: flex;
  320. align-items: center;
  321. box-sizing: border-box;
  322. image {
  323. width: 140rpx;
  324. height: 140rpx;
  325. margin-right: 20rpx;
  326. }
  327. .right{
  328. flex: 1;
  329. .name{
  330. font-weight: bold;
  331. color: #000000;
  332. font-size: 32rpx;
  333. line-height: 40rpx;
  334. margin-bottom: 20rpx;
  335. }
  336. .remark{
  337. font-size: 26rpx;
  338. color: #59a7ff;
  339. }
  340. .qty{
  341. display: flex;
  342. justify-content: flex-end;
  343. }
  344. }
  345. }
  346. .items {
  347. display: flex;
  348. align-items: center;
  349. justify-content: space-between;
  350. height: 50rpx;
  351. margin-bottom: 30rpx;
  352. .label {
  353. margin-right: 30rpx;
  354. text {
  355. color: $error-color;
  356. }
  357. }
  358. .picker {
  359. .placeholder {
  360. color: $sec-font;
  361. }
  362. .iconfont {
  363. margin-left: 12rpx;
  364. color: $sec-font;
  365. }
  366. }
  367. }
  368. }
  369. .footer{
  370. width: 100%;
  371. position: fixed;
  372. bottom: 0;
  373. left: 0;
  374. z-index: 999;
  375. background-color: #ffffff;
  376. padding: 20rpx;
  377. box-sizing: border-box;
  378. .tip{
  379. background-color: #fffdef;
  380. color: #ff5300;
  381. font-size: 28rpx;
  382. padding: 20rpx 0;
  383. }
  384. .left{
  385. width: 260rpx;
  386. margin-right: 60rpx;
  387. }
  388. }
  389. </style>