index.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('../components/com-title', __DIR__);
  4. ComponentHelper::loadComponentView('com-list-page');
  5. ComponentHelper::loadComponentView('com-list-table');
  6. ?>
  7. <com-list-page :crumbs="crumbs" id="application">
  8. <com-list-table
  9. ref="table"
  10. :api="'star-chain/order/index'"
  11. :search-list="searchList"
  12. >
  13. <el-table-column type="selection"></el-table-column>
  14. <el-table-column prop="order_no" align="center" label="订单编号">
  15. <template slot-scope="scope">
  16. <a href="javascript:void(0);" @click="mallOrder(scope.row.order_id)">
  17. {{ scope.row.order_no }}
  18. </a>
  19. </template>
  20. </el-table-column>
  21. <el-table-column prop="goods" align="center" width="280px" label="商品">
  22. <template slot-scope="scope">
  23. <div class="goods">
  24. <div v-for="(item, index) in scope.row.details" :key="index" class="detail-item">
  25. <el-avatar shape="square" :size="60" fit="fill" :src="item.pic_url"></el-avatar>
  26. <div class="detail-item-info">
  27. <com-title :max="10" :title="item.goods_name"></com-title>
  28. <com-title :max="10" :title="item.goods_attr_name"></com-title>
  29. </div>
  30. <div class="num">{{ item.num }}</div>
  31. </div>
  32. </div>
  33. </template>
  34. </el-table-column>
  35. <el-table-column prop="price" label="商品总价" width="100px" align="center">
  36. <template slot-scope="scope">
  37. {{ scope.row.order.goods_price }}
  38. </template>
  39. </el-table-column>
  40. <el-table-column prop="price" label="邮费" width="80px" align="center">
  41. <template slot-scope="scope">
  42. {{ scope.row.order.shipping_money }}
  43. </template>
  44. </el-table-column>
  45. <el-table-column prop="receiver_name" width="130px" label="收件人" align="center">
  46. <template slot-scope="scope">
  47. <div>
  48. <p>{{ scope.row.order.receiver_name }}</p>
  49. <p>{{ scope.row.order.mobile }}</p>
  50. </div>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="time" label="支付时间" align="center">
  54. <template slot-scope="scope">
  55. {{ scope.row.created_at|dateTimeFormat('Y-m-d H:i:s') }}
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="status" label="订单状态" align="center">
  59. <template slot-scope="scope">
  60. <template v-if="scope.row.status == -1">
  61. <el-tooltip effect="dark" :content="scope.row.error" placement="top-start">
  62. <span>下单失败</span>
  63. </el-tooltip>
  64. </template>
  65. <template v-else>
  66. {{ scope.row.chain_order_status_text }}
  67. </template>
  68. </template>
  69. </el-table-column>
  70. <el-table-column align="center" label="操作">
  71. <template slot-scope="scope">
  72. <el-button
  73. type="text"
  74. :loading="btnLoading"
  75. @click="sendOrder(scope.row.id)"
  76. v-if="scope.row.status == 0 || scope.row.status == -1"
  77. >推送</el-button>
  78. <el-button type="text" :loading="btnLoading" @click="showOrderDetail(scope.row.id)" v-else>订单详情</el-button>
  79. </template>
  80. </el-table-column>
  81. </com-list-table>
  82. <!-- 订单详情 -->
  83. <el-dialog title="订单详情" :visible.sync="dialogVisible" width="50%">
  84. <el-descriptions class="margin-top" v-for="item in orderDetail" title="" :column="3" border v-if="orderDetail">
  85. <el-descriptions-item>
  86. <template slot="label">
  87. 供应链订单编号
  88. </template>
  89. {{ item.orderSn }}
  90. </el-descriptions-item>
  91. <el-descriptions-item>
  92. <template slot="label">
  93. 订单状态
  94. </template>
  95. {{ item.orderStatusDesc }}
  96. </el-descriptions-item>
  97. <el-descriptions-item>
  98. <template slot="label">
  99. 实际支付金额
  100. </template>
  101. {{ item.payAmount }}
  102. </el-descriptions-item>
  103. <el-descriptions-item>
  104. <template slot="label">
  105. 支付时间
  106. </template>
  107. {{ item.payTime }}
  108. </el-descriptions-item>
  109. <el-descriptions-item>
  110. <template slot="label">
  111. 付款类型
  112. </template>
  113. {{ item.payChannelName }}
  114. </el-descriptions-item>
  115. <el-descriptions-item>
  116. <template slot="label">
  117. 物流类型
  118. </template>
  119. {{ item.deliveryTypeDesc }}
  120. </el-descriptions-item>
  121. <el-descriptions-item v-if="item.recieveAddr">
  122. <template slot="label">
  123. 收货地址
  124. </template>
  125. {{ item.recieveAddr.provinceName }}
  126. {{ item.recieveAddr.cityName }}
  127. {{ item.recieveAddr.areaName }}
  128. {{ item.recieveAddr.receiveAddrDetail }}
  129. </el-descriptions-item>
  130. </el-descriptions>
  131. </el-dialog>
  132. </com-list-page>
  133. <script>
  134. const application = new Vue({
  135. el: '#application',
  136. data: {
  137. crumbs: [
  138. {
  139. title: '首页',
  140. router: 'mall/overview/index',
  141. },
  142. {
  143. title: '订单管理',
  144. }
  145. ],
  146. orderDetail: {},
  147. dialogVisible: false,
  148. searchList: [
  149. {
  150. key: 'name',
  151. title: '商品名称',
  152. type: 'text',
  153. },
  154. {
  155. key: 'order_no',
  156. title: '订单号',
  157. type: 'text',
  158. },
  159. {
  160. key: 'receiver_name',
  161. title: '收件人',
  162. type: 'text',
  163. },
  164. ],
  165. btnLoading: false,
  166. },
  167. methods: {
  168. /**
  169. * 字符串裁剪
  170. */
  171. sub(string) {
  172. string = string + ''
  173. var reg = /[\u4e00-\u9fa5]/g, //专业匹配中文
  174. slice = string.substring(0, 15),
  175. chineseCharNum = (~~(slice.match(reg) && slice.match(reg).length)),
  176. realen = slice.length * 2 - chineseCharNum;
  177. return string.substr(0, realen) + (realen < string.length ? "..." : "");
  178. },
  179. /**
  180. * 跳转到商城商品
  181. */
  182. mallOrder(id) {
  183. this.$navigate({
  184. r: 'mall/order/detail',
  185. id: id
  186. })
  187. },
  188. /**
  189. * 展示订单详情
  190. */
  191. showOrderDetail(id) {
  192. this.btnLoading = true
  193. request({
  194. params: {
  195. r: 'star-chain/order/detail',
  196. },
  197. method: 'post',
  198. data: {
  199. id: id,
  200. },
  201. }).then(e => {
  202. if (e.data.code === 0) {
  203. this.orderDetail = e.data.data
  204. this.btnLoading = false
  205. } else {
  206. this.$message.error(e.data.msg);
  207. }
  208. this.dialogVisible = true
  209. })
  210. },
  211. sendOrder(id) {
  212. this.btnLoading = true
  213. request({
  214. params: {
  215. r: 'star-chain/order/resend',
  216. id: id,
  217. },
  218. }).then(e => {
  219. if (e.data.code === 0) {
  220. this.$message.success(e.data.msg);
  221. } else {
  222. this.$message.error(e.data.msg);
  223. }
  224. this.btnLoading = false
  225. })
  226. }
  227. },
  228. })
  229. </script>
  230. <style>
  231. .goods {
  232. display: flex;
  233. flex-direction: column;
  234. }
  235. .detail-item {
  236. display: flex;
  237. flex-direction: row;
  238. align-items: center;
  239. }
  240. .detail-item + .detail-item {
  241. margin-top: 8px;
  242. }
  243. .detail-item-info {
  244. display: flex;
  245. flex-direction: column;
  246. justify-content: center;
  247. align-items: flex-start;
  248. padding: 0 5px;
  249. }
  250. .detail-item-info span {
  251. line-height: 26px;
  252. }
  253. .num::before {
  254. content: '*';
  255. font-size: 16px;
  256. padding: 5px;
  257. color: #F56C6C;
  258. }
  259. .num {
  260. font-size: 16px;
  261. color: #F56C6C;
  262. }
  263. .goods-name {
  264. margin-left: 5px;
  265. }
  266. .page {
  267. margin-top: 10px;
  268. }
  269. </style>