x-orderManagement.vue 9.5 KB

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