order-remarks.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <div class="app-container">
  3. <div v-if="orderNoteList.length === 0" class="order_empty">
  4. <span>暂无订单备注</span>
  5. </div>
  6. <div v-else>
  7. <el-card
  8. v-for="item in orderNoteList"
  9. :key="item.id"
  10. class="box-card"
  11. style="margin: 0 auto"
  12. >
  13. <div class="refund-item">
  14. <el-form label-width="120px">
  15. <el-form-item :label="item.createName">
  16. <div class="order_time">
  17. {{ item.createDate }}
  18. </div>
  19. </el-form-item>
  20. <el-form-item label="备注内容:">
  21. {{ item.remarks }}
  22. </el-form-item>
  23. <el-form-item label="图片:">
  24. <template v-if="item.images.length > 0">
  25. <el-image
  26. v-for="(img, index) in item.images"
  27. :key="index"
  28. :preview-src-list="[img]"
  29. style="width: 148px; height: 148px; margin-right: 20px"
  30. :src="img"
  31. />
  32. </template>
  33. <template v-else>
  34. </template>
  35. </el-form-item>
  36. <el-form-item label="文件:">
  37. <template v-if="item.ossFiles.length > 0">
  38. <div v-for="(file, i) in item.ossFiles" :key="i">
  39. <span class="order_text">{{ file.name }}</span>
  40. <el-button type="text" @click="handlerDownload(file)">下载</el-button>
  41. </div>
  42. </template>
  43. <template v-else> 无 </template>
  44. </el-form-item>
  45. </el-form>
  46. </div>
  47. </el-card>
  48. <div class="goBack">
  49. <el-button plain @click="backToList">返回</el-button>
  50. </div>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import { orderNotes, fileDownload } from '@/api/order'
  56. export default {
  57. name: 'OrderRemarks',
  58. filters: {},
  59. data() {
  60. return {
  61. orderInfo: {},
  62. productRadio: null,
  63. orderNoteList: [] // 订单备注列表
  64. }
  65. },
  66. computed: {
  67. orderId: function() {
  68. return this.$route.query.orderId * 1
  69. },
  70. disabled() {
  71. return this.productRadio === null
  72. },
  73. shopOrderId() {
  74. return this.$route.query.shopOrderId * 1
  75. }
  76. },
  77. created() {
  78. this.orderNotes({ orderId: this.orderId, shopOrderId: this.shopOrderId })
  79. },
  80. methods: {
  81. // 获取订单备注列表
  82. async orderNotes(orderId) {
  83. try {
  84. const { data } = await orderNotes(orderId)
  85. this.orderNoteList = data
  86. } catch (error) {
  87. console.log('error', error)
  88. }
  89. },
  90. // 文件下载
  91. async handlerDownload(res) {
  92. try {
  93. const response = await fileDownload({ fileId: res.id })
  94. // 获取文件流数据
  95. const blob = new Blob([response])
  96. const link = document.createElement('a')
  97. link.href = URL.createObjectURL(blob)
  98. link.download = res.name
  99. document.body.appendChild(link)
  100. link.click()
  101. document.body.removeChild(link)
  102. } catch (error) {
  103. console.log(error)
  104. }
  105. },
  106. handlePayNote() {
  107. this.$router.push({ path: '/order/add-remarks', query: { orderId: this.orderId }})
  108. },
  109. backToList() {
  110. this.$store.dispatch('tagsView/delView', this.$route).then(() => {
  111. this.$nextTick(() => {
  112. this.$router.replace({
  113. path: '/order/deliver',
  114. query: {
  115. orderId: this.orderId
  116. }
  117. })
  118. })
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style scoped lang="scss">
  125. .order_empty {
  126. width: 100%;
  127. height: 40vh;
  128. display: flex;
  129. justify-content: center;
  130. align-items: center;
  131. flex-direction: column;
  132. }
  133. .order_empty span {
  134. color: #409eff;
  135. margin: 1vw;
  136. }
  137. .order_time {
  138. font-weight: 700;
  139. }
  140. .order_text {
  141. margin-right: 20px;
  142. }
  143. .goBack {
  144. width: 100%;
  145. display: flex;
  146. justify-content: center;
  147. align-items: center;
  148. }
  149. ::v-deep .el-form-item__content {
  150. margin-left: 130px !important;
  151. }
  152. .goBack {
  153. margin: 3vw 0;
  154. ::v-deep .el-button--medium {
  155. width: 100px !important;
  156. }
  157. }
  158. ::v-deep .el-card {
  159. margin: 20px auto !important;
  160. }
  161. .app-title {
  162. line-height: 36px;
  163. font-size: 26px;
  164. font-weight: bold;
  165. color: #409eff;
  166. text-align: center;
  167. margin: 0;
  168. }
  169. .box-card {
  170. font-size: 14px;
  171. }
  172. .box-row {
  173. padding: 10px 0;
  174. }
  175. .box-row .dropdown {
  176. margin-top: -10px;
  177. }
  178. .refund-item {
  179. padding: 10px 0;
  180. }
  181. .order-item {
  182. background: #f7f7f7;
  183. margin-bottom: 20px;
  184. padding: 10px 15px;
  185. border-radius: 5px;
  186. }
  187. .product-row {
  188. padding: 10px 0;
  189. background: #ebeef5;
  190. border-top: 1px dashed #dcdfe6;
  191. }
  192. .op-item {
  193. padding: 5px 0;
  194. }
  195. .el-span-warning {
  196. color: #e6a23c;
  197. }
  198. .el-span-success {
  199. color: #67c23a;
  200. }
  201. .el-span-danger {
  202. color: #f56c6c;
  203. }
  204. </style>