OrderList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <div class="my-share personal-info">
  3. <h2>订单管理</h2>
  4. <el-table
  5. :data="orderList"
  6. @sort-change="handleSort"
  7. :default-sort = dataSort
  8. >
  9. <el-table-column
  10. type="index"
  11. label="#"
  12. width="48">
  13. </el-table-column>
  14. <el-table-column
  15. prop="sn"
  16. label="交易单号"
  17. width="200">
  18. </el-table-column>
  19. <el-table-column
  20. prop="pay_time"
  21. label="交易时间"
  22. width="180"
  23. sortable>
  24. </el-table-column>
  25. <el-table-column
  26. prop="goods_name"
  27. label="购买商品"
  28. min-width="220">
  29. </el-table-column>
  30. <el-table-column
  31. label="类型"
  32. width="72">
  33. <template slot-scope="scope" v-if="scope.row.goods_type>=0">
  34. <span class="items-type" :style="{background:typeList[scope.row.goods_type].bg, color:typeList[scope.row.goods_type].color}">{{typeList[scope.row.goods_type].text}}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column
  38. prop="goods_study_phase_name"
  39. label="学段"
  40. width="64">
  41. </el-table-column>
  42. <el-table-column
  43. prop="study"
  44. label="价格"
  45. width="154">
  46. <template slot-scope="scope">
  47. <span class="currectPrice">¥{{scope.row.goods_price_discount?scope.row.goods_price_discount:scope.row.goods_price | cutMoneyFiter}}</span>
  48. <span class="oldPrice" v-if="scope.row.goods_price_discount">(¥{{scope.row.goods_price | cutMoneyFiter}})</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column
  52. label="兑换码"
  53. width="144">
  54. <template slot-scope="scope">
  55. <template v-if="scope.row.is_use_discount_code=='false'">
  56. 未使用
  57. </template>
  58. <template v-else>
  59. <span class="code" :id="'copy-'+scope.row.discount_code">{{scope.row.discount_code}}</span>
  60. <svg-icon icon-class="copy" class="copy" @click="CopyToClipboard('copy-'+scope.row.discount_code)"></svg-icon>
  61. </template>
  62. </template>
  63. </el-table-column>
  64. <el-table-column
  65. label="支付金额"
  66. width="96">
  67. <template slot-scope="scope">
  68. <span>¥{{scope.row.pay_amount | cutMoneyFiter}}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column
  72. prop="pay_type_name"
  73. label="支付渠道"
  74. width="104">
  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.is_pay==='true'&&scope.row.is_use_discount_code==='true'?'success2':scope.row.is_pay==='true'&&scope.row.is_use_discount_code==='false'?'success':'refundFail'].bg}"></span>
  83. <b :style="{color:statusList[scope.row.is_pay==='true'&&scope.row.is_use_discount_code==='true'?'success2':scope.row.is_pay==='true'&&scope.row.is_use_discount_code==='false'?'success':'refundFail'].textColor}">{{statusList[scope.row.is_pay==='true'&&scope.row.is_use_discount_code==='true'?'success2':scope.row.is_pay==='true'&&scope.row.is_use_discount_code==='false'?'success':'refundFail'].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. import { getLogin } from "@/api/ajax";
  123. export default {
  124. //import引入的组件需要注入到对象中才能使用
  125. components: { },
  126. props: [],
  127. filters:{
  128. cutMoneyFiter
  129. },
  130. data() {
  131. //这里存放数据
  132. return {
  133. pageSize: 10,
  134. pageNumber: 1,
  135. statusList:{
  136. 'success':{
  137. text:'支付成功',
  138. bg:'#00B42A',
  139. textColor:'#1D2129'
  140. },
  141. 'success2':{
  142. text:'兑换成功',
  143. bg:'#165DFF',
  144. textColor:'#1D2129'
  145. },
  146. 'refunded':{
  147. text:'已退款',
  148. bg:'#EF21DA',
  149. textColor:'#EF21DA'
  150. },
  151. 'refundFail':{
  152. text:'退款失败',
  153. bg:'#F53F3F',
  154. textColor:'#F53F3F'
  155. },
  156. 'refunding':{
  157. text:'申请退款中',
  158. bg:'#F53F3F',
  159. textColor:'#F53F3F'
  160. }
  161. },
  162. typeList:{
  163. 2:{
  164. text:'报纸',
  165. color:'#165DFF',
  166. bg:'#E8F7FF'
  167. },
  168. // '2':{
  169. // text:'画刊',
  170. // color:'#F53F3F',
  171. // bg:'#FFECE8'
  172. // },
  173. // '3':{
  174. // text:'练习',
  175. // color:'#0FC6C2',
  176. // bg:'#E8FFFB'
  177. // },
  178. 0:{
  179. text:'课程',
  180. color:'#722ED1',
  181. bg:'#F5E8FF'
  182. },
  183. 1:{
  184. text:'课程',
  185. color:'#722ED1',
  186. bg:'#F5E8FF'
  187. },
  188. // '5':{
  189. // text:'报纸专辑',
  190. // color:'#165DFF',
  191. // bg:'#E8F7FF'
  192. // },
  193. // '6':{
  194. // text:'画刊专辑',
  195. // color:'#F53F3F',
  196. // bg:'#FFECE8'
  197. // }
  198. },
  199. orderList:[],
  200. total_count: 0,
  201. dataSort: {}
  202. }
  203. },
  204. //计算属性 类似于data概念
  205. computed: {},
  206. //监控data中数据变化
  207. watch: {
  208. },
  209. //方法集合
  210. methods: {
  211. handleSort(value){
  212. let dataSort = {
  213. prop: value.prop,
  214. order: value.order
  215. }
  216. this.dataSort = dataSort
  217. this.getList()
  218. },
  219. handleSizeChange(val) {
  220. this.pageSize = val
  221. this.pageNumber = 1
  222. this.getList()
  223. },
  224. handleCurrentChange(val) {
  225. this.pageNumber = val
  226. this.getList()
  227. },
  228. CopyToClipboard(element) {
  229. var doc = document,
  230. text = doc.getElementById(element),
  231. range,
  232. selection;
  233. if (doc.body.createTextRange) {
  234. range = doc.body.createTextRange();
  235. range.moveToElementText(text);
  236. range.select();
  237. } else if (window.getSelection) {
  238. selection = window.getSelection();
  239. range = doc.createRange();
  240. range.selectNodeContents(text);
  241. selection.removeAllRanges();
  242. selection.addRange(range);
  243. }
  244. document.execCommand("copy");
  245. this.$message({
  246. message: "复制成功",
  247. type: "success",
  248. });
  249. window.getSelection().removeAllRanges();
  250. },
  251. getList(){
  252. let MethodName = "/ShopServer/Client/OrderManager/PageQueryMyOrderList";
  253. let order_column_list = []
  254. if(this.dataSort != {}){
  255. if(this.dataSort.order=='descending'){
  256. order_column_list = [this.dataSort.prop + ':desc']
  257. }else if(this.dataSort.order=='ascending'){
  258. // 升序不传值
  259. order_column_list = [this.dataSort.prop]
  260. }
  261. }
  262. let data = {
  263. page_capacity:this.pageSize,
  264. cur_page:this.pageNumber,
  265. order_column_list: order_column_list
  266. }
  267. getLogin(MethodName, data)
  268. .then((res) => {
  269. if(res.status===1){
  270. this.orderList = res.order_list
  271. this.total_count = res.total_count
  272. }
  273. })
  274. .catch(() => {
  275. this.loading = false
  276. });
  277. }
  278. },
  279. //生命周期 - 创建完成(可以访问当前this实例)
  280. created() {
  281. this.getList()
  282. },
  283. //生命周期 - 挂载完成(可以访问DOM元素)
  284. mounted() {
  285. },
  286. //生命周期-创建之前
  287. beforeCreated() { },
  288. //生命周期-挂载之前
  289. beforeMount() { },
  290. //生命周期-更新之前
  291. beforUpdate() { },
  292. //生命周期-更新之后
  293. updated() { },
  294. //生命周期-销毁之前
  295. beforeDestory() { },
  296. //生命周期-销毁完成
  297. destoryed() { },
  298. //如果页面有keep-alive缓存功能,这个函数会触发
  299. activated() { }
  300. }
  301. </script>
  302. <style lang="scss" scoped>
  303. /* @import url(); 引入css类 */
  304. .my-share{
  305. background: #FFFFFF;
  306. border-radius: 4px;
  307. padding: 24px;
  308. h2{
  309. font-weight: 500;
  310. font-size: 20px;
  311. line-height: 28px;
  312. color: #1D2129;
  313. margin: 0;
  314. }
  315. .el-table{
  316. margin: 24px 0;
  317. max-width: 100%;
  318. }
  319. .el-pagination{
  320. text-align: right;
  321. }
  322. .status-box{
  323. display: flex;
  324. align-items: center;
  325. span{
  326. width: 6px;
  327. height: 6px;
  328. border-radius: 3px;
  329. margin-right: 8px;
  330. margin-top: 2px;
  331. }
  332. b{
  333. font-weight: 400;
  334. font-size: 14px;
  335. line-height: 22px;
  336. color: #1D2129;
  337. }
  338. }
  339. .order-detail{
  340. color: #165DFF;
  341. margin-right: 8px;
  342. }
  343. .apply{
  344. font-size: 14px;
  345. line-height: 22px;
  346. color: #86909C;
  347. }
  348. .items-type{
  349. padding: 1px 8px;
  350. font-weight: 500;
  351. font-size: 14px;
  352. line-height: 22px;
  353. border-radius: 2px;
  354. }
  355. .oldPrice{
  356. color: #86909C;
  357. margin-left: 8px;
  358. }
  359. .code{
  360. color: #175DFF;
  361. }
  362. .copy{
  363. color: #C9CDD4;
  364. margin-left: 8px;
  365. cursor: pointer;
  366. }
  367. }
  368. </style>