OrderList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <div class="my-share personal-info">
  3. <h2>订单管理</h2>
  4. <el-table
  5. :data="orderList"
  6. >
  7. <el-table-column
  8. type="index"
  9. label="#"
  10. width="48">
  11. </el-table-column>
  12. <el-table-column
  13. prop="orderNumber"
  14. label="交易单号"
  15. width="128">
  16. </el-table-column>
  17. <el-table-column
  18. prop="time"
  19. label="交易时间"
  20. width="144"
  21. sortable>
  22. </el-table-column>
  23. <el-table-column
  24. prop="title"
  25. label="购买商品"
  26. min-width="220">
  27. </el-table-column>
  28. <el-table-column
  29. label="商品类型"
  30. width="128">
  31. <template slot-scope="scope">
  32. <span class="items-type" :style="{background:typeList[scope.row.type].bg, color:typeList[scope.row.type].color}">{{typeList[scope.row.type].text}}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column
  36. prop="study"
  37. label="学段"
  38. width="64">
  39. </el-table-column>
  40. <el-table-column
  41. prop="study"
  42. label="价格"
  43. width="154">
  44. <template slot-scope="scope">
  45. <span class="currectPrice">¥{{scope.row.currectPrice | cutMoneyFiter}}</span>
  46. <span class="oldPrice">(¥{{scope.row.oldPrice | cutMoneyFiter}})</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column
  50. label="兑换码"
  51. width="144">
  52. <template slot-scope="scope">
  53. <template v-if="scope.row.code=='未使用'">
  54. {{scope.row.code}}
  55. </template>
  56. <template v-else>
  57. <span class="code" :id="'copy-'+scope.row.orderNumber">{{scope.row.code}}</span>
  58. <svg-icon icon-class="copy" class="copy" @click="CopyToClipboard('copy-'+scope.row.orderNumber)"></svg-icon>
  59. </template>
  60. </template>
  61. </el-table-column>
  62. <el-table-column
  63. label="支付金额"
  64. width="96">
  65. <template slot-scope="scope">
  66. <span>¥{{scope.row.payPrice | cutMoneyFiter}}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column
  70. label="支付渠道"
  71. width="104">
  72. <template slot-scope="scope">
  73. {{scope.row.paymentChannel?scope.row.paymentChannel:'-'}}
  74. </template>
  75. </el-table-column>
  76. <el-table-column
  77. prop="status"
  78. label="交易状态"
  79. width="112">
  80. <template slot-scope="scope">
  81. <div class="status-box">
  82. <span :style="{background:statusList[scope.row.status].bg}"></span>
  83. <b :style="{color:statusList[scope.row.status].textColor}">{{statusList[scope.row.status].text}}</b>
  84. </div>
  85. </template>
  86. </el-table-column>
  87. <!-- <el-table-column
  88. prop="status"
  89. label="操作"
  90. width="150"
  91. fixed='right'>
  92. <template slot-scope="scope">
  93. <template v-if="scope.row.operate==='1'">
  94. <a class="apply">申请退款</a>
  95. </template>
  96. <template v-if="scope.row.operate==='3'">
  97. <a class="order-detail"><svg-icon icon-class="question-line"></svg-icon>详情</a>
  98. </template>
  99. <template v-if="scope.row.operate==='4'">
  100. <a class="order-detail"><svg-icon icon-class="question-line"></svg-icon>详情</a>
  101. <a class="apply">申请退款</a>
  102. </template>
  103. </template>
  104. </el-table-column> -->
  105. </el-table>
  106. <el-pagination
  107. background
  108. @size-change="handleSizeChange"
  109. @current-change="handleCurrentChange"
  110. :current-page="pageNumber"
  111. :page-sizes="[10, 20, 30, 40, 50]"
  112. :page-size="pageSize"
  113. layout="total, prev, pager, next, sizes, jumper"
  114. :total="total_count">
  115. </el-pagination>
  116. </div>
  117. </template>
  118. <script>
  119. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  120. //例如:import 《组件名称》from ‘《组件路径》';
  121. import { cutMoneyFiter } from '@/utils/defined';
  122. export default {
  123. //import引入的组件需要注入到对象中才能使用
  124. components: { },
  125. props: [],
  126. filters:{
  127. cutMoneyFiter
  128. },
  129. data() {
  130. //这里存放数据
  131. return {
  132. pageSize: 10,
  133. pageNumber: 1,
  134. statusList:{
  135. 'success':{
  136. text:'支付成功',
  137. bg:'#00B42A',
  138. textColor:'#1D2129'
  139. },
  140. 'success2':{
  141. text:'兑换成功',
  142. bg:'#165DFF',
  143. textColor:'#1D2129'
  144. },
  145. 'refunded':{
  146. text:'已退款',
  147. bg:'#EF21DA',
  148. textColor:'#EF21DA'
  149. },
  150. 'refundFail':{
  151. text:'退款失败',
  152. bg:'#F53F3F',
  153. textColor:'#F53F3F'
  154. },
  155. 'refunding':{
  156. text:'申请退款中',
  157. bg:'#F53F3F',
  158. textColor:'#F53F3F'
  159. }
  160. },
  161. typeList:{
  162. '1':{
  163. text:'报纸',
  164. color:'#165DFF',
  165. bg:'#E8F7FF'
  166. },
  167. '2':{
  168. text:'画刊',
  169. color:'#F53F3F',
  170. bg:'#FFECE8'
  171. },
  172. '3':{
  173. text:'练习',
  174. color:'#0FC6C2',
  175. bg:'#E8FFFB'
  176. },
  177. '4':{
  178. text:'课程',
  179. color:'#722ED1',
  180. bg:'#F5E8FF'
  181. },
  182. '5':{
  183. text:'报纸专辑',
  184. color:'#165DFF',
  185. bg:'#E8F7FF'
  186. },
  187. '6':{
  188. text:'画刊专辑',
  189. color:'#F53F3F',
  190. bg:'#FFECE8'
  191. }
  192. },
  193. orderList:[
  194. {
  195. orderNumber:'1234123124124',
  196. title:'第 856 期 TEENS SENIOR 2',
  197. time:'2021-12-12 15:32',
  198. type:'1',
  199. study:'高二',
  200. currectPrice:'12.00',
  201. oldPrice:'16.00',
  202. payPrice:'12.00',
  203. code:'未使用',
  204. paymentChannel:'支付宝',
  205. status:'success',
  206. operate:'1',// 支付成功且没有使用优惠码 申请退款
  207. },
  208. {
  209. orderNumber:'1234123124124',
  210. title:'第 856 期 TEENS SENIOR 2',
  211. time:'2021-12-12 15:32',
  212. type:'2',
  213. study:'高二',
  214. currectPrice:'12',
  215. oldPrice:'16',
  216. payPrice:'12',
  217. code:'398629081',
  218. paymentChannel:'-',
  219. status:'success2',
  220. operate:'2',// 使用兑换码 无操作
  221. },
  222. {
  223. orderNumber:'1234123124124',
  224. title:'第 856 期 TEENS SENIOR 2',
  225. time:'2021-12-12 15:32',
  226. type:'1',
  227. study:'高二',
  228. currectPrice:'12',
  229. oldPrice:'16',
  230. payPrice:'12',
  231. code:'未使用',
  232. paymentChannel:'微信支付',
  233. status:'success', // 已退款
  234. operate:'1',//已退款 详情
  235. },
  236. {
  237. orderNumber:'1234123124124',
  238. title:'第 856 期 TEENS SENIOR 2',
  239. time:'2021-12-12 15:32',
  240. type:'1',
  241. study:'高二',
  242. currectPrice:'12',
  243. oldPrice:'16',
  244. payPrice:'12',
  245. code:'未使用',
  246. paymentChannel:'支付宝',
  247. status:'success',
  248. operate:'2',//退款失败 详情+申请退款
  249. },
  250. {
  251. orderNumber:'1234123124124',
  252. title:'第 856 期 TEENS SENIOR 2',
  253. time:'2021-12-12 15:32',
  254. type:'2',
  255. study:'高二',
  256. currectPrice:'12',
  257. oldPrice:'16',
  258. payPrice:'12',
  259. code:'未使用',
  260. paymentChannel:'支付宝',
  261. status:'success2',
  262. operate:'1',//退款中
  263. }
  264. ],
  265. total_count: 0
  266. }
  267. },
  268. //计算属性 类似于data概念
  269. computed: {},
  270. //监控data中数据变化
  271. watch: {
  272. },
  273. //方法集合
  274. methods: {
  275. handleSizeChange(val) {
  276. this.pageSize = val
  277. },
  278. handleCurrentChange(val) {
  279. this.pageNumber = val
  280. },
  281. // 跳转文章
  282. handleLink(row){
  283. },
  284. CopyToClipboard(element) {
  285. var doc = document,
  286. text = doc.getElementById(element),
  287. range,
  288. selection;
  289. if (doc.body.createTextRange) {
  290. range = doc.body.createTextRange();
  291. range.moveToElementText(text);
  292. range.select();
  293. } else if (window.getSelection) {
  294. selection = window.getSelection();
  295. range = doc.createRange();
  296. range.selectNodeContents(text);
  297. selection.removeAllRanges();
  298. selection.addRange(range);
  299. }
  300. document.execCommand("copy");
  301. this.$message({
  302. message: "复制成功",
  303. type: "success",
  304. });
  305. window.getSelection().removeAllRanges();
  306. },
  307. },
  308. //生命周期 - 创建完成(可以访问当前this实例)
  309. created() {
  310. },
  311. //生命周期 - 挂载完成(可以访问DOM元素)
  312. mounted() {
  313. },
  314. //生命周期-创建之前
  315. beforeCreated() { },
  316. //生命周期-挂载之前
  317. beforeMount() { },
  318. //生命周期-更新之前
  319. beforUpdate() { },
  320. //生命周期-更新之后
  321. updated() { },
  322. //生命周期-销毁之前
  323. beforeDestory() { },
  324. //生命周期-销毁完成
  325. destoryed() { },
  326. //如果页面有keep-alive缓存功能,这个函数会触发
  327. activated() { }
  328. }
  329. </script>
  330. <style lang="scss" scoped>
  331. /* @import url(); 引入css类 */
  332. .my-share{
  333. background: #FFFFFF;
  334. border-radius: 4px;
  335. padding: 24px;
  336. h2{
  337. font-weight: 500;
  338. font-size: 20px;
  339. line-height: 28px;
  340. color: #1D2129;
  341. margin: 0;
  342. }
  343. .el-table{
  344. margin: 24px 0;
  345. max-width: 100%;
  346. }
  347. .el-pagination{
  348. text-align: right;
  349. }
  350. .status-box{
  351. display: flex;
  352. align-items: center;
  353. span{
  354. width: 6px;
  355. height: 6px;
  356. border-radius: 3px;
  357. margin-right: 8px;
  358. margin-top: 2px;
  359. }
  360. b{
  361. font-weight: 400;
  362. font-size: 14px;
  363. line-height: 22px;
  364. color: #1D2129;
  365. }
  366. }
  367. .order-detail{
  368. color: #165DFF;
  369. margin-right: 8px;
  370. }
  371. .apply{
  372. font-size: 14px;
  373. line-height: 22px;
  374. color: #86909C;
  375. }
  376. .items-type{
  377. padding: 1px 8px;
  378. font-weight: 500;
  379. font-size: 14px;
  380. line-height: 22px;
  381. border-radius: 2px;
  382. }
  383. .oldPrice{
  384. color: #86909C;
  385. margin-left: 8px;
  386. }
  387. .code{
  388. color: #175DFF;
  389. }
  390. .copy{
  391. color: #C9CDD4;
  392. margin-left: 8px;
  393. cursor: pointer;
  394. }
  395. }
  396. </style>