index.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-list-page');
  4. ComponentHelper::loadComponentView('com-list-table');
  5. ComponentHelper::loadComponentView('com-export-dialog');
  6. ComponentHelper::loadComponentView('com-user-info');
  7. ?>
  8. <com-list-page :crumbs="crumbs" id="application">
  9. <com-list-table
  10. ref="table"
  11. @selection-change="handleSelectionChange"
  12. :search-list="searchList"
  13. @search="handleSearch"
  14. @set-action-name="setActionName"
  15. :active-name="activeName"
  16. :api-params="apiParams"
  17. @get-api-data="getApiData"
  18. >
  19. <el-table-column type="selection" width="50"></el-table-column>
  20. <el-table-column prop="user" align="center" min-width="180" label="会员信息">
  21. <template slot-scope="scope">
  22. <com-user-info :user="scope.row.user"></com-user-info>
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="type_text" label="业务类型" align="center"></el-table-column>
  26. <el-table-column prop="money" label="流失金额" align="center"></el-table-column>
  27. <el-table-column prop="order_no" label="订单编号" align="center"></el-table-column>
  28. <el-table-column label="来源会员信息" width="180">
  29. <template slot-scope="scope">
  30. <div class="table-info-img-text" v-if="scope.row.from_user">
  31. <el-image class="table-info-img circle" :src="scope.row.from_user.avatar_url">
  32. <div slot="error" class="image-slot">
  33. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  34. </div>
  35. </el-image>
  36. <div class="table-info-text">
  37. <div v-if="scope.row.from_user.id">ID:{{scope.row.from_user.id}}</div>
  38. <div v-if="scope.row.from_user.nickname">昵称:{{scope.row.from_user.nickname}}
  39. </div>
  40. </div>
  41. </div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="name" label="商品信息">
  45. <template slot-scope="scope">
  46. <div style="display: flex;align-items: center;">
  47. <div style="margin-right:10px;"><img :src="scope.row.cover_pic"
  48. style="width: 40px;height: 40px;display: block;"/></div>
  49. <div>
  50. <div style="text-align: left;line-height: 16px;">{{scope.row.goods_name}}</div>
  51. </div>
  52. </div>
  53. </template>
  54. </el-table-column>
  55. <el-table-column prop="num" label="商品数量" align="center"></el-table-column>
  56. <el-table-column label="创建时间" align="center">
  57. <template slot-scope="scope">
  58. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  59. </template>
  60. </el-table-column>
  61. <template slot="header-left">
  62. <com-export-dialog
  63. style="margin-left: 20px "
  64. :field_list='exportList'
  65. :action_url='export_url'
  66. :params="searchInfo">
  67. </com-export-dialog>
  68. </template>
  69. </com-list-table>
  70. </com-list-page>
  71. <script>
  72. const application = new Vue({
  73. el: '#application',
  74. data: {
  75. crumbs: [
  76. {
  77. title: '流失金额',
  78. router: '',
  79. }
  80. ],
  81. searchList: [
  82. {
  83. key: 'keyword',
  84. title: '请输入用户昵称/手机号搜索',
  85. type: 'text',
  86. },
  87. {
  88. key: 'order_no',
  89. title: '请输入订单编号',
  90. type: 'text',
  91. },
  92. {
  93. key: 'type',
  94. title: '请选择业务类型',
  95. type: 'select',
  96. options: [
  97. {
  98. label: '请选择业务类型',
  99. value: '0'
  100. }, {
  101. label: '上级配货',
  102. value: '1'
  103. },
  104. {
  105. label: '下级补货',
  106. value: '2'
  107. }, {
  108. label: '会员买货',
  109. value: '3'
  110. },
  111. ],
  112. valueKey: {
  113. label: 'label',
  114. value: 'value',
  115. },
  116. },
  117. {
  118. key: 'date',
  119. title: '日期',
  120. type: 'date-picker',
  121. valueFormat: 'yyyy-MM-dd',
  122. },
  123. ],
  124. btnLoad: false,
  125. apply_edit: false,
  126. id:0,
  127. remark:'',
  128. check_remark:'',
  129. check_status:'1',
  130. export_url: 'cloud-stock/loss-amount/index', // 导出路径
  131. exportList: {},
  132. searchInfo: {
  133. active_name: 'settlement',
  134. },
  135. activeName: 'settlement',
  136. apiParams:{
  137. r: 'cloud-stock/loss-amount/index',
  138. active_name: 'settlement',
  139. },
  140. multipleSelection: []
  141. },
  142. mounted() {
  143. this.getExportList();
  144. },
  145. methods: {
  146. getExportList() {
  147. this.listLoading = true;
  148. let params = {
  149. r: 'cloud-stock/loss-amount/get-export-list',
  150. };
  151. request({
  152. params: params,
  153. method: 'get',
  154. }).then(e => {
  155. if (e.data.code == 0) {
  156. this.exportList = e.data.data;
  157. } else {
  158. this.$message.error(e.data.msg);
  159. }
  160. }).catch(e => {
  161. this.loading = false;
  162. });
  163. },
  164. handleSelectionChange(val) {
  165. this.multipleSelection = val;
  166. },
  167. handleSearch(keyword) {
  168. this.searchInfo = keyword;
  169. this.searchInfo.active_name = this.activeName;
  170. },
  171. setActionName(val) {
  172. this.searchInfo.active_name = val;
  173. this.activeName = val
  174. this.$set(this.apiParams, "active_name", val)
  175. this.$refs.table.handleSearch();
  176. },
  177. getApiData(data) {
  178. },
  179. manualSettlement() {
  180. if (this.multipleSelection.length <= 0) {
  181. this.$message.error('请选择要结算的平级奖');
  182. return;
  183. }
  184. var ids = [];
  185. for (let i = 0; i < this.multipleSelection.length; i++) {
  186. ids.push(this.multipleSelection[i].id);
  187. }
  188. let self = this;
  189. self.$confirm('是否结算已选中数据, 是否继续?', '提示', {
  190. confirmButtonText: '确定',
  191. cancelButtonText: '取消',
  192. type: 'warning'
  193. }).then(() => {
  194. self.listLoading = true;
  195. request({
  196. params: {
  197. r: 'cloud-stock/equal-award/manual-settlement',
  198. },
  199. method: 'post',
  200. data: {
  201. id: ids,
  202. }
  203. }).then(e => {
  204. self.listLoading = false;
  205. if (e.data.code === 0) {
  206. self.$message.success(e.data.msg);
  207. this.$refs.table.getList();
  208. } else {
  209. self.$message.error(e.data.msg);
  210. }
  211. }).catch(e => {
  212. console.log(e);
  213. });
  214. }).catch(() => {
  215. self.$message.info('已取消删除')
  216. });
  217. }
  218. }
  219. })
  220. </script>