dlOrderList.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <div class="order-wrapper">
  3. <!-- <breadcrumb :item-name="['订单管理', '订单列表']"></breadcrumb> -->
  4. <div style="padding: 20px;background-color: #fff;">
  5. <!-- 搜索区域 -->
  6. <el-row>
  7. <el-col>
  8. <div class="flex" style="justify-content: flex-end;padding-bottom: 20px;">
  9. <!-- <el-button type="primary" @click="openBuy">购买Token</el-button> -->
  10. <el-button type="primary" icon="el-icon-refresh-right" @click="getList('reload')">刷新</el-button>
  11. </div>
  12. </el-col>
  13. <!-- <el-col :span="8">
  14. <el-input placeholder="请输入内容" v-model="queryInfo.query" class="input-with-select">
  15. <el-button slot="append" icon="el-icon-search" @click="getList()"></el-button>
  16. </el-input>
  17. </el-col> -->
  18. </el-row>
  19. <!-- 订单表格区域 -->
  20. <el-table :data="list" border style="width: 100%" max-height="620" @selection-change="handleSelectionChange">
  21. <el-table-column
  22. type="selection"
  23. width="55">
  24. </el-table-column>
  25. <el-table-column prop="id" label="id" width="80">
  26. </el-table-column>
  27. <el-table-column prop="order_id" label="订单编号" width="200">
  28. </el-table-column>
  29. <el-table-column prop="sys_address" label="是否系统默认" width="170">
  30. <template slot-scope="scope">
  31. <span :style="{'color': (scope.row.sys_address == 1 || scope.row.sys_phone == 1 )? '': '#67c23a'}">{{(scope.row.sys_address == 1 || scope.row.sys_phone == 1 )? '是': '否'}}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column prop="consignee_phone" label="收货手机号" width="200">
  35. </el-table-column>
  36. <el-table-column prop="consignee_address" label="收货地址" width="350">
  37. </el-table-column>
  38. <el-table-column prop="pay_price" label="支付金额(元)" width="150">
  39. </el-table-column>
  40. <!-- <el-table-column prop="token" label="Token" width="350">
  41. </el-table-column> -->
  42. <!-- <el-table-column prop="status" label="是否已使用">
  43. <template slot-scope="scope">
  44. <el-tag type="success" v-if="scope.row.status == 0">待使用</el-tag>
  45. <el-tag type="info" v-if="scope.row.status == 1">已使用</el-tag>
  46. </template>
  47. </el-table-column> -->
  48. <el-table-column prop="createtime" label="创建时间" width="300">
  49. <template slot-scope="scope">
  50. {{showTime(scope.row.createtime)}}
  51. </template>
  52. </el-table-column>
  53. <!-- <el-table-column
  54. fixed="right"
  55. label="操作"
  56. width="100">
  57. <template slot-scope="scope">
  58. <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
  59. <el-button type="text" size="small">编辑</el-button>
  60. </template>
  61. </el-table-column> -->
  62. </el-table>
  63. <!-- 分页区域 -->
  64. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  65. :current-page="queryInfo.page" :page-sizes="[10, 20, 50, 100]" :page-size="queryInfo.pagesize"
  66. layout="total, sizes, prev, pager, next, jumper" :total="total">
  67. </el-pagination>
  68. </div>
  69. <!-- 修改地址对话框 -->
  70. <el-dialog title="购买Token" :visible.sync="dialogTableVisible">
  71. <el-form :model="form">
  72. <el-form-item label="购买数量" :label-width="formLabelWidth">
  73. <el-input v-model="form.num" type="number"></el-input>
  74. </el-form-item>
  75. <el-form-item label="交易密码" :label-width="formLabelWidth">
  76. <el-input v-model="form.transaction" type="password"></el-input>
  77. </el-form-item>
  78. </el-form>
  79. <div slot="footer" class="dialog-footer">
  80. <el-button @click="dialogTableVisible = false">取 消</el-button>
  81. <el-button type="primary" @click="goBuy">确 定</el-button>
  82. </div>
  83. </el-dialog>
  84. </div>
  85. </template>
  86. <script>
  87. import {
  88. createCode,
  89. getCodeList,
  90. createToken,
  91. getTokenList,
  92. getOrderList
  93. } from '@/request/agent.js'
  94. import { showTime } from '@/assets/js/tools.js'
  95. export default {
  96. name: 'Order',
  97. data() {
  98. return {
  99. loading: false,
  100. formLabelWidth: '80px',
  101. form: {
  102. num: '',
  103. transaction: ''
  104. },
  105. dialogTableVisible: false,
  106. queryInfo: {
  107. keyword: '',
  108. page: 1,
  109. limit: 10
  110. },
  111. list: [],
  112. total: 0,
  113. dataloading: false,
  114. }
  115. },
  116. created() {
  117. this.getList()
  118. },
  119. methods: {
  120. showTime,
  121. handleSelectionChange(val) {
  122. console.log(val);
  123. },
  124. openBuy() {
  125. this.dialogTableVisible = true
  126. },
  127. goBuy() {
  128. let that = this
  129. if (that.loading) {
  130. return
  131. }
  132. if (!that.form.num) {
  133. return that.$msg.error('请输入购买数量')
  134. }
  135. if (!that.form.transaction) {
  136. return that.$msg.error('请输入交易密码')
  137. }
  138. that.loading = true
  139. createToken(that.form).then(res => {
  140. console.log(res);
  141. that.$msg.success('购买成功')
  142. that.dialogTableVisible = false
  143. that.loading = false
  144. that.getList('reload')
  145. }).catch(err => {
  146. that.loading = false
  147. })
  148. },
  149. getList(type) {
  150. let that = this
  151. if (that.dataloading) {
  152. return
  153. }
  154. if (type == 'reload') {
  155. that.queryInfo = {
  156. keyword: '',
  157. page: 1,
  158. limit: 10
  159. }
  160. }
  161. that.dataloading = true
  162. getOrderList(that.queryInfo).then(res => {
  163. that.total = res.data.count
  164. that.list = res.data.data
  165. that.dataloading = false
  166. }).catch(err => {
  167. that.dataloading = false
  168. })
  169. },
  170. handleSizeChange(newPageSize) {
  171. this.queryInfo.limit = newPageSize
  172. this.queryInfo.page = 1
  173. this.getList()
  174. },
  175. handleCurrentChange(newPageNum) {
  176. this.queryInfo.page = newPageNum
  177. this.getList()
  178. },
  179. },
  180. }
  181. </script>
  182. <style scoped>
  183. </style>