orderbtob_details.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <div class="orderbtob_details_wrapper">
  3. <div class="mobile-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p>订单详情</p>
  6. </div>
  7. <div class="orderbtob_details_content">
  8. <div class="orderbtob_details_top">
  9. <template v-if="vendorType === 'saler'">
  10. <div class="item">
  11. <span class="name">客户:</span>
  12. {{listInfo.enterprise.enName}}
  13. </div>
  14. <div class="item">
  15. <span class="name">收货地址:</span>
  16. {{listInfo.enterprise.enAddress}}
  17. </div>
  18. <div class="item">
  19. <span class="name">订单号:</span>
  20. {{listInfo.code}}
  21. </div>
  22. <div class="item">
  23. <span class="name">单据时间:</span>
  24. {{listInfo.date | time}}
  25. </div>
  26. <div class="item">
  27. <span class="name">币别:</span>
  28. {{listInfo.currency}}
  29. </div>
  30. <div class="item">
  31. <span class="name">金额:</span>
  32. {{listInfo.sum | toFixedNum}}
  33. </div>
  34. <div class="item">
  35. <span class="name">备注:</span>
  36. {{listInfo.remark || '无'}}
  37. </div>
  38. </template>
  39. <template v-else>
  40. <div class="item">
  41. <span class="name">供应商:</span>
  42. {{listInfo.receiveName}}
  43. </div>
  44. <div class="item">
  45. <span class="name">录单人:</span>
  46. {{listInfo.recorder}}
  47. </div>
  48. <div class="item">
  49. <span class="name">交货地址:</span>
  50. {{listInfo.shipAddress}}
  51. </div>
  52. <div class="item">
  53. <span class="name">订单号:</span>
  54. {{listInfo.code}}
  55. </div>
  56. <div class="item">
  57. <span class="name">单据时间:</span>
  58. {{listInfo.date | time}}
  59. </div>
  60. <div class="item">
  61. <span class="name">付款方式:</span>
  62. {{listInfo.payments || '无'}}
  63. </div>
  64. <div class="item">
  65. <span class="name">币别:</span>
  66. {{listInfo.currency}}
  67. </div>
  68. <div class="item">
  69. <span class="name">金额:</span>
  70. {{listInfo.sum | toFixedNum}}
  71. </div>
  72. <div class="item">
  73. <span class="name">备注:</span>
  74. {{listInfo.remark || '无'}}
  75. </div>
  76. </template>
  77. </div>
  78. <div class="orderbtob_details_middle">
  79. <div class="list" v-for="(item, index) in listInfo.orderItems">
  80. <div class="item">
  81. <span class="name">编号:</span>{{item.product.code}}
  82. </div>
  83. <div class="item">
  84. <span class="name">产品:</span>{{item.product.title}}
  85. </div>
  86. <div class="item clearfix">
  87. <div class="name fl">规格型号:</div>
  88. <div class="fl ovrflow">{{item.product.spec}}</div>
  89. </div>
  90. <div class="item">
  91. <span class="name">购买数量:</span>{{item.qty}}
  92. </div>
  93. <div class="item" v-if="item.acceptQty">
  94. <span class="name">已验收:</span>{{item.acceptQty}}{{item.product.unit}}
  95. </div>
  96. <div class="item" v-if="item.returnQty">
  97. <span class="name">已验退:</span>{{item.returnQty}}{{item.product.unit}}
  98. </div>
  99. <ul class="bottom" v-if="item.replayList.length > 0">
  100. <li v-for="ls in item.replayList">
  101. <span style="margin-right:0.1rem"> <strong>{{ls.date | time}}</strong></span>
  102. <span style="margin-right:0.1rem">{{ls.recorder}}</span>
  103. <span>回复数量:{{ls.qty}}</span>
  104. </li>
  105. </ul>
  106. <div v-if="(!item.replyQty || item.replyQty < item.qty) && listInfo.end !== 1 && listInfo.display !== 1">
  107. <div class="item clearfix">
  108. <span class="name">回复数量:</span>
  109. <input type="number" class="dateinput" v-model="count">
  110. </div>
  111. <div class="item clearfix">
  112. <span class="name">交货日期:</span>
  113. <input type="date" :min="item.delivery | time" class="dateinput" v-model="date">
  114. </div>
  115. <div class="item clearfix">
  116. <span class="name">备注:</span>
  117. <input type="text" class="dateinput" v-model="remank">
  118. </div>
  119. <div class="replayBtn" @click="Replay(item)">
  120. 回复
  121. </div>
  122. </div>
  123. <div v-if="item.replyQty >= 0 && item.replayList.length === 0" class="replayBtn" @click="LookReplay(item)">
  124. 查看回复
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  130. </div>
  131. </template>
  132. <script>
  133. import { RemindBox } from '~components/mobile/common'
  134. export default {
  135. name: 'orderbtob_details',
  136. layout: 'mobileActivity',
  137. middleware: 'authenticated',
  138. data() {
  139. return {
  140. listInfo: {
  141. enterprise: {}
  142. },
  143. date: '',
  144. count: '',
  145. remank: '',
  146. collectResult: '',
  147. timeoutCount: 0,
  148. token: ''
  149. }
  150. },
  151. created() {
  152. this.getInitInfo()
  153. this._getToken()
  154. },
  155. computed: {
  156. vendorType() {
  157. return this.$route.query.type
  158. }
  159. },
  160. methods: {
  161. Replay(item) {
  162. if (this.count === '') {
  163. this._iniFo('数量不能为空')
  164. } else if (Number(this.count) > Number(item.qty)) {
  165. this._iniFo('回复数量不能大于订单数量')
  166. } else {
  167. this.$http.post(`/sale/orders/items/${item.id}/reply?token=${this.token}`, {
  168. delivery: new Date().getTime(),
  169. qty: this.count,
  170. remark: this.remank
  171. }).then(res => {
  172. this.remank = ''
  173. this.count = ''
  174. this._iniFo('回复成功')
  175. this.getInitInfo()
  176. })
  177. }
  178. },
  179. LookReplay(item) {
  180. this.$http.get(`/sale/orders/items/${item.id}/reply/all`).then(res => {
  181. item.replayList = res.data
  182. })
  183. },
  184. _iniFo(str) {
  185. this.collectResult = str
  186. this.timeoutCount++
  187. },
  188. _getToken() {
  189. this.$http.get('/token?userType=sale').then(res => {
  190. this.token = res.data.token
  191. })
  192. },
  193. getInitInfo() {
  194. let _url = ''
  195. if (this.vendorType === 'saler') {
  196. _url = `/sale/orders/${this.$route.query.id}/info`
  197. } else {
  198. _url = `/sale/orders/purc/${this.$route.query.id}/info`
  199. }
  200. this.$http.get(_url).then(res => {
  201. res.data.sum = 0
  202. res.data.orderItems.forEach(item => {
  203. res.data.sum += item.qty * item.price
  204. item.replayList = []
  205. item.showReplay = false
  206. })
  207. res.data.sum = parseFloat(res.data.sum).toFixed(2)
  208. this.listInfo = res.data
  209. })
  210. }
  211. },
  212. filters: {
  213. time: function(time) {
  214. if (typeof time === 'number') {
  215. if (!time) {
  216. return '无'
  217. } else {
  218. let d = new Date(time)
  219. let year = d.getFullYear()
  220. let month = d.getMonth() + 1 < 10 ? '0' + (d.getMonth() + 1) : '' + (d.getMonth() + 1)
  221. let day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
  222. return year + '-' + month + '-' + day
  223. }
  224. }
  225. },
  226. toFixedNum: function (num) {
  227. return num ? parseFloat(num).toFixed(2) : '-'
  228. }
  229. },
  230. components: {
  231. RemindBox
  232. }
  233. }
  234. </script>
  235. <style scoped lang="scss">
  236. .orderbtob_details_wrapper {
  237. background: #f5f5f5;
  238. position: absolute;
  239. height: 100%;
  240. width: 100%;
  241. overflow-y: scroll;
  242. .mobile-header{
  243. position: fixed;
  244. top: 0;
  245. z-index: 10;
  246. width:100%;
  247. height:.88rem;
  248. line-height: .88rem;
  249. /*border-bottom:.01rem solid #ccc;*/
  250. background: #3e82f5;
  251. padding:0 .2rem 0 .1rem;
  252. color:#fff;
  253. }
  254. .mobile-header p{
  255. overflow: hidden;
  256. text-overflow: ellipsis;
  257. white-space: nowrap;
  258. font-size:.36rem;
  259. text-align: center;
  260. margin: 0;
  261. width: 6rem;
  262. padding-left: 1rem;
  263. }
  264. .mobile-header a{
  265. font-size:.28rem;
  266. color:#fff;
  267. position: absolute;
  268. }
  269. .mobile-header a i{
  270. font-size: .48rem;
  271. margin-right: -.1rem;
  272. }
  273. .orderbtob_details_content {
  274. margin-top: 0.9rem;
  275. padding: 0.2rem;
  276. .orderbtob_details_top {
  277. background: #3f84f6;
  278. border-radius: 0.07rem;
  279. border: solid 0.01rem #e3e5e8;
  280. padding: 0.24rem 0.2rem 0.14rem;
  281. .item {
  282. color: #fff;
  283. font-size: 0.28rem;
  284. margin-bottom: 0.1rem;
  285. }
  286. }
  287. .orderbtob_details_middle {
  288. margin-top: 0.2rem;
  289. .list {
  290. border: solid 1px #e3e5e8;
  291. border-radius: 0.07rem;
  292. overflow: hidden;
  293. color: #333;
  294. font-size: 0.28rem;
  295. padding: 0.24rem 0.2rem;
  296. margin-bottom: 0.2rem;
  297. background: #fff;
  298. .item {
  299. margin-bottom: 0.1rem;
  300. line-height: 0.5rem;
  301. }
  302. .ovrflow {
  303. width: 5.2rem;
  304. line-height: 0.5rem
  305. }
  306. .name {
  307. color: #666;
  308. width: 1.4rem;
  309. display: inline-block;
  310. }
  311. .dateinput {
  312. width: 3.49rem;
  313. height: .5rem;
  314. line-height: .5rem;
  315. border: 1px solid #aeaeae;
  316. font-size: .26rem;
  317. vertical-align: middle;
  318. background: #fff;
  319. border-radius: 0;
  320. }
  321. }
  322. .replayBtn {
  323. width: 6.59rem;
  324. height: 0.77rem;
  325. background-color: #3f84f6;
  326. border-radius: 0.08rem;
  327. font-size: 0.28rem;
  328. line-height: 0.77rem;
  329. color: #ffffff;
  330. overflow: hidden;
  331. text-align: center;
  332. margin-top: 0.2rem
  333. }
  334. }
  335. .bottom {
  336. font-size: 0.2rem;
  337. color: #999;
  338. border-top: 1px solid #aeaeae;
  339. padding-top: 0.1rem;
  340. }
  341. }
  342. }
  343. </style>