receiving.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view class="order-card">
  3. <view class="order-card-title">
  4. <text class="info">{{shareInfo.share.tenantName || ''}}</text>
  5. <text class="no">No {{shareInfo.share.code || ''}}</text>
  6. <view class="orderStatus-info">
  7. <u--image width="100rpx" height="88rpx" v-if="shareInfo.share.orderStatus == 0"
  8. src="/subpages/static/img/no-take-order.png"></u--image>
  9. <u--image width="100rpx" height="88rpx" v-if="shareInfo.share.orderStatus == 1"
  10. src="/subpages/static/img/start-take-order.png"></u--image>
  11. <u--image width="100rpx" height="88rpx" v-if="shareInfo.share.orderStatus == 2"
  12. src="/subpages/static/img/completed.png"></u--image>
  13. <u--image width="100rpx" height="88rpx" v-if="shareInfo.share.orderStatus == 4"
  14. src="/subpages/static/img/cancellation.png"></u--image>
  15. </view>
  16. </view>
  17. <view class="order-info">
  18. <view class="order-type">
  19. <span class="tag tag-l" v-if="shareInfo.share.orderType == '1'">{{$t('order.temp')}}</span>
  20. <span class="tag tag-g" v-if="shareInfo.share.orderType == '2'">{{$t('order.fixed')}}</span>
  21. <span class="tag tag-s" v-if="shareInfo.share.orderType == '4'">{{$t('order.share')}}</span>
  22. </view>
  23. <view class="row">
  24. <p class="cell">
  25. <text class="label">{{$t('order.orderDate')}}</text>
  26. <text class="info">{{shareInfo.share.setDate || ''}}</text>
  27. </p>
  28. </view>
  29. <view class="row">
  30. <p class="cell">
  31. <text class="label">{{$t('order.vehicleType')}}</text>
  32. <text class="info" v-if="shareInfo.share.vehicleType == '101'">{{$t('order.saleOrder')}}</text>
  33. <text class="info" v-if="shareInfo.share.vehicleType == '102'">{{$t('order.purchaseOrder')}}</text>
  34. </p>
  35. </view>
  36. <view class="row">
  37. <p class="cell">
  38. <text class="label">{{$t('mine.customer')}}</text>
  39. <text class="info">{{shareInfo.share.companyName || ''}}</text>
  40. </p>
  41. </view>
  42. <view class="row">
  43. <p class="cell">
  44. <text class="label">{{$t('mine.mater')}}</text>
  45. <text class="info">{{shareInfo.share.materialName || ''}}</text>
  46. </p>
  47. </view>
  48. <view class="row">
  49. <p class="cell">
  50. <text class="label">{{$t('order.orderDate')}}</text>
  51. <text class="info">{{shareInfo.share.createTime || ''}}</text>
  52. </p>
  53. </view>
  54. <view class="row">
  55. <p class="cell">
  56. <text class="label">{{$t('order.allowOrderReceiving')}}</text>
  57. <text class="info">{{shareInfo.share.orderNumber}} {{$t('customer_meter.unitN')}}</text>
  58. </p>
  59. <p class="cell">
  60. <text class="label">{{$t('order.haveOrderReceiving')}}</text>
  61. <text class="info">{{( shareInfo.orderInfo.length)}} {{$t('customer_meter.unitN')}}</text>
  62. </p>
  63. </view>
  64. <view class="row p">
  65. <p class="cell">
  66. <text class="label">{{$t('order.orderNumber')}}</text>
  67. <u--input v-model="form.orderNumber" type="number" border="none" :placeholder="$t('base.common.placeholderI') +$t('order.orderReceiveNumber')">
  68. </u--input>
  69. </p>
  70. </view>
  71. <view class="row" @click="showPopup('popupVehicle')">
  72. <p class="cell">
  73. <text class="label">{{$t('order.vehicle')}}</text>
  74. <u--input readonly v-model="form.vehicle" border="none"
  75. :placeholder="$t('base.common.placeholderS')+$t('order.vehicle')"></u--input>
  76. <u-icon slot="right" name="arrow-right"></u-icon>
  77. </u--input>
  78. </p>
  79. </view>
  80. </view>
  81. <view>
  82. <u-button type="primary" color='#4680F9' @click="onSubmit()">{{$t('order.orderReceiving')}}</u-button>
  83. </view>
  84. <PopupSelect ref="popupVehicle" :option="vehicleList" @onConfirm="onVehicleConfirm" />
  85. </view>
  86. </template>
  87. <script>
  88. import {
  89. publicUrl
  90. } from '../../utils/config'
  91. import PopupSelect from '../../components/popup-select/index'
  92. import {
  93. getShareOrderInfo,
  94. driverReceiving
  95. } from "../../api/order"
  96. import {
  97. getVehicleListByCondition,
  98. } from "../../api/driver"
  99. import {
  100. mapMutations,
  101. } from 'vuex';
  102. export default {
  103. components: {
  104. PopupSelect
  105. },
  106. data() {
  107. return {
  108. shareInfo: {
  109. share: {},
  110. orderInfo: []
  111. },
  112. vehicleList: [{
  113. text: this.$t('base.common.noData'),
  114. value: null
  115. }], //车牌选项
  116. form: {
  117. vehicle: '',
  118. appDriverId: '',
  119. orderNumber: '',
  120. },
  121. userType: "0",
  122. }
  123. },
  124. onLoad(options) {
  125. if (uni.getStorageSync('userType') != '4') {
  126. uni.showModal({
  127. content: '您不是司机身份,不可接单',
  128. showCancel: false,
  129. success: (res) => {
  130. console.log(res);
  131. if (res.confirm) {
  132. getApp().globalData.index = 0
  133. uni.switchTab({
  134. url: '/pages/home/home'
  135. })
  136. }
  137. }
  138. })
  139. return;
  140. }
  141. this.getOrderInfoById(options)
  142. },
  143. methods: {
  144. ...mapMutations({
  145. setUserInfo: 'user/login'
  146. }),
  147. //获取订单详情
  148. getOrderInfoById(data) {
  149. let that = this
  150. getShareOrderInfo(data).then(res => {
  151. if (res.statusCode == 200) {
  152. that.shareInfo = res.data.data.data
  153. console.log("获取到订单信息、", that.shareInfo);
  154. that.onGetVehicelList();
  155. }
  156. })
  157. },
  158. onGetVehicelList() {
  159. let that = this
  160. let data = {}
  161. getVehicleListByCondition(data).then(res => {
  162. if (res.statusCode == 200) {
  163. if (res.data.data.length > 0) {
  164. that.vehicleList = [{
  165. text: this.$t('order.notSelected'),
  166. value: null
  167. }] //物料选项
  168. res.data.data.forEach(item => {
  169. that.vehicleList.push({
  170. text: item.vehicle,
  171. value: item.id
  172. })
  173. })
  174. }
  175. console.log("获取到车号信息、", that.vehicleList);
  176. }
  177. })
  178. },
  179. //确定接单
  180. onSubmit() {
  181. let that = this
  182. if (!that.shareInfo || !that.shareInfo.share || !that.shareInfo.share.id) {
  183. uni.showToast({
  184. title: "不存在共享订单信息",
  185. icon: 'none',
  186. duration: 2000
  187. })
  188. return;
  189. }
  190. if (!this.form.orderNumber) {
  191. uni.showToast({
  192. title: "请输入订单数量",
  193. icon: 'none',
  194. duration: 2000
  195. })
  196. return;
  197. }
  198. if (!this.form.vehicle) {
  199. uni.showToast({
  200. title: "请选择车辆信息",
  201. icon: 'none',
  202. duration: 2000
  203. })
  204. return;
  205. }
  206. let data = {
  207. ...that.form,
  208. tenantId: that.shareInfo.share.tenantId,
  209. orderId: that.shareInfo.share.id,
  210. }
  211. driverReceiving(data).then(res => {
  212. if (res.data.code == 0 && res.statusCode == 200) {
  213. uni.showModal({
  214. content: '接单成功',
  215. showCancel: false,
  216. success: ({
  217. confirm,
  218. cancel
  219. }) => {
  220. if (confirm) {
  221. uni.switchTab({
  222. url: '/pages/home/home'
  223. })
  224. }
  225. }
  226. })
  227. }
  228. })
  229. },
  230. onVehicleConfirm(item) {
  231. this.form.vehicle = "";
  232. this.form.appDriverId = "";
  233. if (item.value) {
  234. this.form.vehicle = item.text
  235. this.form.appDriverId = item.value
  236. }
  237. },
  238. //显示选择
  239. showPopup(refs) {
  240. this.$refs[refs].showPicker = true
  241. },
  242. }
  243. }
  244. </script>
  245. <style lang="scss" scoped>
  246. .order-card {
  247. background-color: #fff;
  248. border-radius: 10rpx;
  249. overflow: hidden;
  250. margin: 4rpx 20rpx;
  251. border: solid 1px #c1bebe;
  252. .order-card-title {
  253. display: flex;
  254. justify-content: space-between;
  255. background: linear-gradient(to right, #a9a7a7, #fff);
  256. padding: 14rpx;
  257. line-height: 40rpx;
  258. font-size: 32rpx;
  259. font-weight: 600;
  260. color: #333;
  261. position: relative;
  262. flex-direction: column;
  263. border-bottom: solid 1px #6a6a6a;
  264. .orderStatus-info {
  265. position: absolute;
  266. right: 0;
  267. padding-right: 10px;
  268. .iconImg {
  269. width: 100rpx;
  270. height: 88rpx;
  271. margin-top: 15rpx;
  272. }
  273. .iconImg2 {
  274. width: 100rpx;
  275. height: 100rpx;
  276. margin-top: 15rpx;
  277. }
  278. .iconImg1 {
  279. width: 130rpx;
  280. height: 80rpx;
  281. margin-top: 20rpx;
  282. }
  283. }
  284. .no {
  285. font-size: 22rpx;
  286. color: #f20505;
  287. }
  288. .info {}
  289. }
  290. .order-info {
  291. background-color: #fff;
  292. font-size: 28rpx;
  293. line-height: 56rpx;
  294. padding: 24rpx;
  295. color: #333;
  296. position: relative;
  297. .order-type {
  298. position: absolute;
  299. right: 10px;
  300. top: 5px;
  301. }
  302. .tag {
  303. padding: 0 20rpx 0 16rpx;
  304. border-top-right-radius: 40rpx;
  305. border-bottom-right-radius: 40rpx;
  306. height: 40rpx;
  307. line-height: 40rpx;
  308. }
  309. .tag-l {
  310. border: 1px solid #f9ae3d;
  311. background-color: #fdf6ec;
  312. color: #f9ae3d;
  313. }
  314. .tag-g {
  315. border: 1px solid #3c9cff;
  316. background-color: #ecf5ff;
  317. color: #3c9cff;
  318. }
  319. .tag-s {
  320. border: 1px solid #f56c6c;
  321. background-color: #f0ecec;
  322. color: #f56c6c;
  323. }
  324. .row {
  325. align-items: center;
  326. display: flex;
  327. .cell {
  328. flex: 1;
  329. display: flex;
  330. .label {
  331. width: 150rpx;
  332. font-size: 26rpx;
  333. font-weight: bold;
  334. }
  335. .info {
  336. flex: 1;
  337. font-size: 20rpx;
  338. }
  339. }
  340. }
  341. .p {
  342. padding-top: 28rpx;
  343. border-top: 2rpx solid #d6d7d9;
  344. }
  345. .share-button {
  346. width: 150rpx;
  347. position: absolute;
  348. right: 0;
  349. bottom: 0;
  350. background: transparent;
  351. }
  352. }
  353. .top {
  354. padding-top: 50rpx;
  355. }
  356. .order-bottom {
  357. display: flex;
  358. justify-content: flex-end;
  359. padding: 24rpx;
  360. border-top: solid 1px #6a6a6a;
  361. background: linear-gradient(to right, #d0cece, #fff);
  362. .btn {
  363. width: 25%;
  364. margin-left: 32rpx;
  365. }
  366. }
  367. }
  368. </style>