x-orderManagement.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view style="width: 100%;">
  3. <view class="card_ordermang" v-for="(item,index) in orderList" :key="index" @click="goOrderDetails(item)">
  4. <view class="head_ordermang space_between">
  5. <view class="waybill_title">运单号:<span>{{item.waybillNo}}</span></view>
  6. <span class="card_state" :style="{color:getState(item.status)}">{{orderStatus(item.status)}}</span>
  7. </view>
  8. <view class="space_between">
  9. <view class="card_specification">
  10. <view class="specification_title">
  11. <u-tag :text="item.temperatureInterval" plain size="mini" type="success"
  12. @click="goOrderDetails(item)"></u-tag>
  13. </view>
  14. <view class="specification_title">
  15. <u-tag :text="item.deliveryCondition" plain size="mini" type="primary"
  16. @click="goOrderDetails(item)"></u-tag>
  17. </view>
  18. <view class="specification_title">
  19. <u-tag :text="item.cargoType" plain size="mini" type="warning"
  20. @click="goOrderDetails(item)"></u-tag>
  21. </view>
  22. </view>
  23. <view style="font-size: 28rpx;">x{{item.quantity}}</view>
  24. </view>
  25. <view class="title_ordermang"><span>收货地址:</span>{{item.consigneeAddressDetails}}</view>
  26. <view class="title_ordermang"><span>收货电话:</span>{{item.consigneeAddressPhone}}</view>
  27. <view class="title_ordermang"><span>下单时间:</span>{{item.orderTime}}</view>
  28. <view style="display: flex;">
  29. <view class="btn_printil markd10"
  30. v-if="item.status == 1 || item.status == 2 || item.status == 3 || item.status == 9"
  31. @click.stop="modifyOrder(item)">
  32. <u-button size="small" type="warning" text="修改订单"></u-button>
  33. </view>
  34. <view class="btn_printil markd10" v-if="printbarCode(item.status)" @click.stop="printBarCode(item)">
  35. <u-button size="small" type="primary" text="打印条码"></u-button>
  36. </view>
  37. </view>
  38. <view style="display: flex;">
  39. <view class="btn_printil markd10" v-if="item.status == 8 && userInfo.userType == 'sys'"
  40. @click.stop="sendmail(item)">
  41. <u-button size="small" type="primary" text="发送温湿度记录PDF"></u-button>
  42. </view>
  43. <view class="btn_printil markd10" v-if="item.status == 8 && userInfo.userType == 'sys'"
  44. @click.stop="humidityRecording(item)">
  45. <u-button size="small" type="success" text="打印温湿度记录"></u-button>
  46. </view>
  47. </view>
  48. </view>
  49. <u-popup :show="shareShow" mode="center" round="5" closeable @close="shareShow = false">
  50. <view style="padding: 0rpx 30rpx 30rpx 30rpx;margin-top: 50rpx; width: 400rpx;">
  51. <u-button style="margin: 20rpx 0rpx;" type="success" text="发送邮箱" @click="sendingMailbox"></u-button>
  52. <u-button type="primary" text="分享微信好友" @click="shareWechatFriends"></u-button>
  53. </view>
  54. </u-popup>
  55. </view>
  56. </template>
  57. <script>
  58. const FileShare = uni.requireNativePlugin('life-FileShare');
  59. export default {
  60. name: 'xOrderManagement',
  61. props: {
  62. // 订单列表
  63. orderList: {
  64. type: Array,
  65. default: () => [],
  66. },
  67. userInfo: {
  68. type: Object,
  69. default: () => {},
  70. }
  71. },
  72. data() {
  73. return {
  74. shareShow: false,
  75. optionList: {},
  76. }
  77. },
  78. mounted() {
  79. // console.log(this.userInfo, 26)
  80. },
  81. methods: {
  82. // 打印条码
  83. printBarCode(value) {
  84. this.$cache.setCache('commodity', JSON.stringify(value))
  85. uni.navigateTo({
  86. url: '/pages/order/quantum?waybillNo=' + value.waybillNo + '&printType=barCode'
  87. });
  88. },
  89. // 打印温湿度记录
  90. humidityRecording(value) {
  91. this.$cache.setCache('commodity', JSON.stringify(value))
  92. uni.navigateTo({
  93. url: '/pages/order/quantum?waybillNo=' + value.waybillNo + '&printType=record'
  94. });
  95. },
  96. // 发送邮件
  97. sendmail(value) {
  98. this.shareShow = true
  99. this.optionList = value
  100. },
  101. // 发送邮箱
  102. sendingMailbox() {
  103. this.shareShow = false
  104. this.$emit('sendmail', this.optionList)
  105. },
  106. // 分享微信好友
  107. shareWechatFriends() {
  108. uni.showLoading({
  109. title: '获取温湿度记录中,请稍等',
  110. mask: true,
  111. });
  112. this.$api.post('/api/waybill/temperature-pdf-url', {
  113. waybillNo: this.optionList.waybillNo,
  114. }).then(res => {
  115. if (res.code == 200) {
  116. let arrData = res.data.split("/");
  117. var dtask = plus.downloader.createDownload(res.data, {
  118. filename: "_doc/pdf/" + arrData[3]
  119. }, function(d, status) {
  120. // 下载完成
  121. if (status == 200) {
  122. FileShare.render({
  123. type: "WX", //QQ为QQ,微信为WX,系统默认是SYSTEM,不填写默认SYSTEM
  124. filePath: plus.io.convertLocalFileSystemURL(d.filename),
  125. }, result => {
  126. uni.hideLoading()
  127. });
  128. } else {
  129. console.log("Download failed: " + status);
  130. }
  131. });
  132. dtask.start();
  133. }
  134. uni.hideLoading()
  135. }).catch(() => {
  136. uni.hideLoading()
  137. })
  138. return
  139. },
  140. // 修改订单
  141. modifyOrder(value) {
  142. this.$cache.setCache('orderDetails', value)
  143. uni.redirectTo({
  144. url: '/pages/order/addWaybill?title=修改订单&type=2'
  145. });
  146. },
  147. // 订单详情
  148. goOrderDetails(value) {
  149. this.$cache.setCache('orderDetails', value)
  150. uni.navigateTo({
  151. url: '/pages/order/orderDetails?type=details'
  152. });
  153. },
  154. // 订单状态
  155. orderStatus(value) {
  156. if (this.userInfo.userType == 'sys') {
  157. if (this.userInfo.type == 2) {
  158. // 仓管
  159. if (value == 3) {
  160. return '未入库'
  161. } else if (value == 5) {
  162. return '已入库'
  163. } else if (value == 9) {
  164. return '待装箱'
  165. } else if (value == 10) {
  166. return '已装箱'
  167. } else if (value == 11) {
  168. return '已出箱'
  169. } else if (value == 7) {
  170. return '已出库'
  171. }
  172. } else if (this.userInfo.type == 3) {
  173. // 司机
  174. if (value == 2) {
  175. return '未装车'
  176. } else if (value == 9) {
  177. return '待装箱'
  178. } else if (value == 10) {
  179. return '已装箱'
  180. } else if (value == 4) {
  181. return '已装车'
  182. } else if (value == 6) {
  183. return '已下车'
  184. } else if (value == 8) {
  185. return '已签收'
  186. }
  187. }
  188. } else {
  189. if (value == 1 || value == 2 || value == 3) {
  190. return '未发货'
  191. } else if (value == 4 || value == 5 || value == 6 || value == 7) {
  192. return '已发货'
  193. } else if (value == 8) {
  194. return '已签收'
  195. }
  196. }
  197. },
  198. // 订单文字颜色
  199. getState(value) {
  200. if (this.userInfo.userType == 'sys') {
  201. if (this.userInfo.type == 2) {
  202. // 仓管
  203. if (value == 3) {
  204. return '#ff9900'
  205. } else if (value == 9) {
  206. return '#ff9900'
  207. } else if (value == 10) {
  208. return '#19be6b'
  209. } else if (value == 5) {
  210. return '#19be6b'
  211. } else {
  212. return '#606266'
  213. }
  214. } else if (this.userInfo.type == 3) {
  215. // 司机
  216. if (value == 2) {
  217. return '#ff9900'
  218. } else if (value == 9) {
  219. return '#ff9900'
  220. } else if (value == 10) {
  221. return '#19be6b'
  222. } else if (value == 4) {
  223. return '#19be6b'
  224. } else if (value == 6) {
  225. return '#19be6b'
  226. } else {
  227. return '#606266'
  228. }
  229. }
  230. } else {
  231. if (value == 1 || value == 2 || value == 3) {
  232. return '#ff9900'
  233. } else if (value == 4 || value == 5 || value == 6 || value == 7) {
  234. return '#19be6b'
  235. } else {
  236. return '#606266'
  237. }
  238. }
  239. },
  240. // 打印运单
  241. printbarCode(type) {
  242. if (this.userInfo.userType === 'sys' && [2, 3, 9, 10].includes(type)) {
  243. return true
  244. } else {
  245. return false
  246. }
  247. }
  248. }
  249. }
  250. </script>
  251. <style lang="scss">
  252. .card_ordermang {
  253. background-color: #fff;
  254. padding: 20rpx;
  255. border-radius: 20rpx;
  256. margin: 20rpx;
  257. }
  258. .head_ordermang {
  259. margin-bottom: 10rpx;
  260. }
  261. .title_ordermang {
  262. margin-top: 10rpx;
  263. font-size: 26rpx;
  264. color: #909399;
  265. span {
  266. font-size: 26rpx;
  267. color: #909399;
  268. margin-right: 10rpx;
  269. }
  270. }
  271. .waybill_title {
  272. font-size: 32rpx;
  273. span {
  274. margin-left: 10rpx;
  275. }
  276. }
  277. .card_state {
  278. color: #606266;
  279. font-size: 32rpx;
  280. }
  281. .card_specification {
  282. display: flex;
  283. align-items: center;
  284. }
  285. .specification_title {
  286. margin-right: 20rpx;
  287. }
  288. .btn_printil {
  289. flex: 1;
  290. margin-top: 10px;
  291. }
  292. .markd10:nth-child(1) {
  293. margin: 10px 10rpx 0px 0rpx;
  294. }
  295. .markd10:nth-child(2) {
  296. margin: 10px 0rpx 0px 10rpx;
  297. }
  298. </style>