orderDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <view class="content">
  3. <view class="box">
  4. <view class="hflex acenter">
  5. <image :src="pageData.user.headimg" class="avatar"></image>
  6. <view class="vflex" style="padding-left: 12rpx;">
  7. <view class="text_style1 text_hide" style="max-width: 500rpx;">{{pageData.user.nickname}}</view>
  8. <view class="hflex acenter">
  9. <view class="text_style2">{{pageData.city}}</view>
  10. <view class="text_style2" style="padding: 0 10rpx;">|</view>
  11. <view class="text_style2">{{pageData.create_at}}发布</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="text_style3 cell">{{pageData.describe}}</view>
  16. <view class="cell">
  17. <block v-for="(item,index) in pageData.imgs" :key="index">
  18. <image :src="item" mode="aspectFill" class="img" @tap="preview"></image>
  19. </block>
  20. </view>
  21. <view class="hflex acenter jbetween cell">
  22. <view class="label">联系方式</view>
  23. <view class="text_style3">{{pageData.user.phone}}</view>
  24. </view>
  25. <view class="hflex acenter jbetween cell">
  26. <view class="label">维修时间</view>
  27. <view class="text_style3">{{pageData.start_time}}至{{pageData.end_time}}</view>
  28. </view>
  29. <view class="hflex acenter jbetween cell">
  30. <view class="label">维修地点</view>
  31. <view class="text_style3">{{pageData.city}} {{pageData.area}} {{pageData.address}}</view>
  32. </view>
  33. </view>
  34. <view class="box hflex acenter jbetween" style="margin-bottom: 186rpx;">
  35. <view class="title">订单类型</view>
  36. <view class="right">{{pageData.quick == 1 ? '普修' : '快修'}}</view>
  37. </view>
  38. <view class="bottom">
  39. <view class="bottom_btn" @click="openOffer" v-if="pageData.status == 1 ">立即接单</view>
  40. <view class="bottom_btn bottom_btn2" @click="openSee" v-else>已报价,立即查看</view>
  41. </view>
  42. <u-popup :show="quotation_show" mode="center" :round="10" :closeable="true" :safeAreaInsetBottom="false" @close="close">
  43. <view class="popup">
  44. <view class="popup_title">立即报价</view>
  45. <view class="input_bg hflex acenter">
  46. <view class="price">¥</view>
  47. <u-input v-model="offer" placeholder="填写你的报价" border="none"></u-input>
  48. </view>
  49. <view class="hflex acenter">
  50. <image src="https://ship-expert.zhousi.hdlkeji.com/common/icon_tips.png" style="width: 24rpx;height: 24rpx;padding-right: 6rpx"></image>
  51. <view class="popup_info">报价可先不填,可等评估后再填写</view>
  52. </view>
  53. <view class="hflex acenter" style="padding:30rpx 0 20rpx;">
  54. <view class="price">上传图片及资质证明图</view>
  55. </view>
  56. <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="9"></u-upload>
  57. <view class="popup_btn" @click="submit">提交</view>
  58. </view>
  59. </u-popup>
  60. <u-popup :show="detail_show" mode="center" :round="10" :closeable="true" :safeAreaInsetBottom="false" @close="close">
  61. <view class="popup">
  62. <view class="popup_title">报价信息</view>
  63. <view class="popup_name">当前报价</view>
  64. <view class="">
  65. <block v-for="(item,index) in offer_info.list" :key="index">
  66. <view class="hflex acenter input_bg">
  67. <view class="popup_text">第{{index + 1}}次报价</view>
  68. <view class="red">{{item.price == 0 ? '暂无报价' : item.price}}</view>
  69. </view>
  70. </block>
  71. </view>
  72. <!-- <view class="hflex acenter input_bg" v-if="offer_info.list.length >= 1">
  73. <view class="popup_text">第一次报价</view>
  74. <view class="red">{{offer_info.list[0].price}}</view>
  75. </view>
  76. <view class="hflex acenter input_bg" v-if="offer_info.list.length >= 2">
  77. <view class="popup_text">第二次报价</view>
  78. <view class="red">{{offer_info.list[1].price}}</view>
  79. </view>
  80. <view class="hflex acenter input_bg" v-if="offer_info.list.length >= 3">
  81. <view class="popup_text">第三次报价</view>
  82. <view class="red">{{offer_info.list[2].price}}</view>
  83. </view> -->
  84. <view class="popup_name">图片及资质证明图片</view>
  85. <view>
  86. <block v-for="(item,index) in offer_info.imgs" :key="index">
  87. <image :src="item" mode="aspectFill" style="width: 188rpx;height: 188rpx;margin: 0 14rpx 20rpx 0;border-radius: 16rpx;"></image>
  88. </block>
  89. </view>
  90. <view class="popup_btn" @click="toDetail">查看详情</view>
  91. </view>
  92. </u-popup>
  93. </view>
  94. </template>
  95. <script>
  96. import $api from '@/static/js/api.js'
  97. var that = ''
  98. export default {
  99. data() {
  100. return {
  101. pageData: {
  102. },
  103. quotation_show: false,
  104. offer: '',
  105. fileList1: [],
  106. imgs: '',
  107. detail_show: false,
  108. offer_info: {
  109. },
  110. id: '',
  111. }
  112. },
  113. onLoad(options) {
  114. that = this
  115. that.id = options.id
  116. that.getData()
  117. that.getOffer()
  118. },
  119. methods: {
  120. getData() {
  121. $api.req({
  122. url: '/data/api.auth.ShipEngineMaintenance/repairdetail',
  123. method: 'POST',
  124. data: {
  125. id: that.id
  126. }
  127. }, function(res) {
  128. if(res.code == 1) {
  129. console.log(res);
  130. that.pageData = res.data
  131. }
  132. })
  133. },
  134. getOffer() {
  135. $api.req({
  136. url: '/data/api.auth.ShipEngineMaintenance/offerinfo',
  137. method: 'POST',
  138. data: {
  139. id: that.id
  140. }
  141. }, function(res) {
  142. if(res.code == 1) {
  143. that.offer_info = res.data
  144. }
  145. })
  146. },
  147. preview() {
  148. uni.previewImage({
  149. urls: that.pageData.imgs
  150. })
  151. },
  152. // 立即接单
  153. openOffer() {
  154. var maintenance = uni.getStorageSync('maintenance')
  155. if(maintenance) {
  156. that.quotation_show = true
  157. } else {
  158. $api.info("请先成为维修工")
  159. }
  160. },
  161. submit() {
  162. console.log(that.pageData.status);
  163. that.pageData.status = 2
  164. console.log(that.pageData.status);
  165. $api.req({
  166. url: '/data/api.auth.ShipEngineMaintenance/repairoffer',
  167. method: 'POST',
  168. data: {
  169. id: that.id,
  170. price: that.offer,
  171. imgs: that.imgs
  172. }
  173. }, function(res) {
  174. if(res.code == 1) {
  175. $api.info(res.info)
  176. that.close()
  177. // that.pageData = {}
  178. // that.getData()
  179. }
  180. })
  181. },
  182. // 查看报价
  183. openSee() {
  184. that.detail_show = true
  185. },
  186. // 关闭
  187. close() {
  188. that.quotation_show = false
  189. that.detail_show = false
  190. },
  191. // 删除图片
  192. deletePic(event) {
  193. this[`fileList${event.name}`].splice(event.index, 1)
  194. },
  195. // 新增图片
  196. async afterRead(event) {
  197. uni.showLoading({
  198. title: '上传中',
  199. mask: true
  200. })
  201. let lists = [].concat(event.file)
  202. let fileListLen = this[`fileList${event.name}`].length
  203. lists.map((item) => {
  204. this[`fileList${event.name}`].push({
  205. ...item,
  206. status: 'uploading',
  207. message: '上传中'
  208. })
  209. })
  210. for (let i = 0; i < lists.length; i++) {
  211. const result = await this.uploadFilePromise(lists[i].url)
  212. let item = this[`fileList${event.name}`][fileListLen]
  213. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  214. status: 'success',
  215. message: '',
  216. url: result.url
  217. }))
  218. fileListLen++
  219. if(lists.length - 1 == i) {
  220. uni.hideLoading()
  221. }
  222. }
  223. if(that[`fileList${event.name}`].length > 0) {
  224. for(var i=0;i<that[`fileList${event.name}`].length;i++) {
  225. if(i == that[`fileList${event.name}`].length -1) {
  226. that.imgs += that[`fileList${event.name}`][i].url
  227. } else {
  228. that.imgs += that[`fileList${event.name}`][i].url + ','
  229. }
  230. }
  231. }
  232. },
  233. // 上传图片
  234. uploadFilePromise(url) {
  235. return new Promise((resolve, reject) => {
  236. let a = uni.uploadFile({
  237. url: $api.config.baseUrl + '/data/api.auth.Center/upload',
  238. filePath: url,
  239. name: 'file',
  240. header: {
  241. 'content-type': 'application/x-www-form-urlencoded',
  242. 'api-token': uni.getStorageSync('token').token?uni.getStorageSync('token').token:'',
  243. 'api-name': 'wxapp'
  244. },
  245. formData: {
  246. user: 'test'
  247. },
  248. success: (res) => {
  249. setTimeout(() => {
  250. var data = JSON.parse(res.data)
  251. resolve(data.data)
  252. }, 1000)
  253. }
  254. });
  255. })
  256. },
  257. toDetail() {
  258. $api.jump('/page_shop/pages/order/offer2?id=' + that.id + '&status=' + that.pageData.status)
  259. },
  260. },
  261. }
  262. </script>
  263. <style lang="scss" scoped>
  264. .content {
  265. background: #F4F4F4;
  266. .box {
  267. width: 690rpx;
  268. margin: 20rpx 30rpx 0;
  269. background: #FFFFFF;
  270. border-radius: 10px;
  271. box-sizing: border-box;
  272. padding: 20rpx;
  273. .avatar {
  274. width: 72rpx;
  275. height: 72rpx;
  276. border-radius: 50%;
  277. }
  278. .text_style1 {
  279. font-size: 28rpx;
  280. font-weight: 500;
  281. color: #222222;
  282. line-height: 40rpx;
  283. }
  284. .text_style2 {
  285. font-size: 22rpx;
  286. font-weight: 400;
  287. color: #B7B7B7;
  288. line-height: 32rpx;
  289. }
  290. .text_style3 {
  291. font-size: 28rpx;
  292. font-weight: 400;
  293. color: #444444;
  294. line-height: 44rpx;
  295. }
  296. .img {
  297. width: 200rpx;
  298. height: 200rpx;
  299. border-radius: 12rpx;
  300. margin: 0 14rpx 20rpx 0;
  301. }
  302. .img:nth-child(3n+3) {
  303. margin: 0 0 20rpx 0;
  304. }
  305. .label {
  306. width: 200rpx;
  307. font-size: 26rpx;
  308. font-weight: 400;
  309. color: #777777;
  310. line-height: 36rpx;
  311. }
  312. .title {
  313. font-size: 30rpx;
  314. font-weight: 400;
  315. color: #222222;
  316. line-height: 42rpx;
  317. }
  318. .right {
  319. font-size: 30rpx;
  320. font-weight: 500;
  321. color: #506DFF;
  322. line-height: 42rpx;
  323. }
  324. .cell {
  325. padding: 14rpx 0;
  326. }
  327. }
  328. .bottom {
  329. width: 100%;
  330. z-index: 9;
  331. position: fixed;
  332. bottom: 0;
  333. height: 166rpx;
  334. background: #FFFFFF;
  335. box-sizing: border-box;
  336. padding: 8rpx 40rpx 74rpx;
  337. .bottom_btn {
  338. width: 100%;
  339. height: 84rpx;
  340. background: #506DFF;
  341. border-radius: 42rpx;
  342. font-size: 36rpx;
  343. font-weight: 500;
  344. color: #FFFFFF;
  345. text-align: center;
  346. line-height: 84rpx;
  347. }
  348. .bottom_btn2 {
  349. background: rgba(80,109,255,0.5);
  350. }
  351. }
  352. .popup {
  353. width: 670rpx;
  354. background: #FFFFFF;
  355. border-radius: 10px;
  356. box-sizing: border-box;
  357. padding: 36rpx 30rpx 24rpx;
  358. .popup_title {
  359. width: 100%;
  360. text-align: center;
  361. font-size: 32rpx;
  362. font-weight: 500;
  363. color: #222222;
  364. margin-bottom: 24rpx;
  365. }
  366. .popup_name {
  367. font-size: 26rpx;
  368. font-weight: 400;
  369. color: #222222;
  370. padding: 28rpx 0 20rpx;
  371. }
  372. .popup_text {
  373. font-size: 22rpx;
  374. font-weight: 500;
  375. color: #777777;
  376. padding-right: 60rpx;
  377. }
  378. .input_bg {
  379. background: #F4F4F4;
  380. border-radius: 8px;
  381. box-sizing: border-box;
  382. padding: 16rpx 20rpx;
  383. margin: 20rpx 0;
  384. .price {
  385. font-size: 32rpx;
  386. font-weight: 500;
  387. color: #222222;
  388. padding-right: 20rpx;
  389. }
  390. .u-textarea {
  391. background-color: #F4F4F4 !important;
  392. }
  393. .red {
  394. font-size: 28rpx;
  395. font-weight: bold;
  396. color: #FF3636;
  397. }
  398. }
  399. .popup_info {
  400. font-size: 20rpx;
  401. font-weight: 400;
  402. color: #C0C0C0;
  403. line-height: 28rpx;
  404. }
  405. .popup_btn {
  406. width: 610rpx;
  407. height: 80rpx;
  408. background: #506DFF;
  409. border-radius: 40rpx;
  410. font-size: 32rpx;
  411. font-weight: 500;
  412. color: #FFFFFF;
  413. text-align: center;
  414. line-height: 80rpx;
  415. margin: 20rpx 0;
  416. }
  417. }
  418. }
  419. </style>