orderbtob_details.vue 8.0 KB

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