index.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. :tabs="tabs"
  15. @set-action-name="setActionName"
  16. :active-name="activeName"
  17. :api-params="apiParams"
  18. @get-api-data="getApiData"
  19. >
  20. <el-table-column type="selection" width="50"></el-table-column>
  21. <el-table-column prop="user" align="center" min-width="180" label="会员信息">
  22. <template slot-scope="scope">
  23. <com-user-info :user="scope.row.user"></com-user-info>
  24. </template>
  25. </el-table-column>
  26. <el-table-column prop="capital_type" label="佣金类型" align="center">
  27. <template slot-scope="scope">
  28. <span v-if="scope.row.capital_type=='equal'">云库存-平级奖励</span>
  29. <span v-if="scope.row.capital_type=='price_difference_equal'">云库存-云库存差价平级奖</span>
  30. </template>
  31. </el-table-column>
  32. <el-table-column prop="change_num" label="结算金额(元)" align="center"></el-table-column>
  33. <el-table-column prop="desc" label="说明" align="center" min-width="200"></el-table-column>
  34. <el-table-column prop="order_no" label="订单编号" align="center"></el-table-column>
  35. <el-table-column label="来源用户" width="180">
  36. <template slot-scope="scope">
  37. <div class="table-info-img-text" v-if="scope.row.from_user">
  38. <el-image class="table-info-img circle" :src="scope.row.from_user.avatar_url">
  39. <div slot="error" class="image-slot">
  40. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  41. </div>
  42. </el-image>
  43. <div class="table-info-text">
  44. <div v-if="scope.row.from_user.id">ID:{{scope.row.from_user.id}}</div>
  45. <div v-if="scope.row.from_user.nickname">昵称:{{scope.row.from_user.nickname}}
  46. </div>
  47. </div>
  48. </div>
  49. </template>
  50. </el-table-column>
  51. <el-table-column
  52. prop="name"
  53. label="下单商品"
  54. >
  55. <template slot-scope="scope">
  56. <div style="display: flex;align-items: center;">
  57. <div style="margin-right:10px;"><img :src="scope.row.cover_pic"
  58. style="width: 40px;height: 40px;display: block;"/></div>
  59. <div>
  60. <div style="text-align: left;line-height: 16px;">{{scope.row.goods_name}}</div>
  61. </div>
  62. </div>
  63. </template>
  64. </el-table-column>
  65. <el-table-column prop="num" label="商品件数" align="center"></el-table-column>
  66. <el-table-column label="创建时间" align="center">
  67. <template slot-scope="scope">
  68. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  69. </template>
  70. </el-table-column>
  71. <template slot="header-left" v-if="activeName=='noSettlement'">
  72. <el-button type="primary" size="small" @click="manualSettlement">手动结算</el-button>
  73. </template>
  74. <template slot="header-left">
  75. <com-export-dialog
  76. style="margin-left: 20px "
  77. :field_list='exportList'
  78. :action_url='export_url'
  79. :params="searchInfo">
  80. </com-export-dialog>
  81. </template>
  82. <template slot="statistics">
  83. <el-row :gutter="24" class="statistics-box">
  84. <el-col :span="6" v-for="(item, index) in statistic" :key="index">
  85. <el-card shadow="hover" style="width: 100%;">
  86. <el-statistic
  87. group-separator=","
  88. :precision="item.precision"
  89. :value="item.value"
  90. :title="item.title"
  91. ></el-statistic>
  92. </el-card>
  93. </el-col>
  94. </el-row>
  95. </template>
  96. </com-list-table>
  97. </com-list-page>
  98. <script>
  99. const application = new Vue({
  100. el: '#application',
  101. data: {
  102. crumbs: [
  103. {
  104. title: '平级奖',
  105. router: '',
  106. }
  107. ],
  108. searchList: [
  109. {
  110. key: 'keyword',
  111. title: '请输入用户昵称/手机号搜索',
  112. type: 'text',
  113. },
  114. {
  115. key: 'order_no',
  116. title: '请输入订单编号',
  117. type: 'text',
  118. },
  119. {
  120. key: 'capital_type',
  121. title: '请选择佣金类型',
  122. type: 'select',
  123. options: [
  124. {
  125. label: '云库存-平级奖励',
  126. value: 'equal'
  127. },
  128. {
  129. label: '云库存-云库存差价平级奖',
  130. value: 'price_difference_equal'
  131. },
  132. ],
  133. valueKey: {
  134. label: 'label',
  135. value: 'value',
  136. },
  137. },
  138. {
  139. key: 'date',
  140. title: '日期',
  141. type: 'date-picker',
  142. valueFormat: 'yyyy-MM-dd',
  143. },
  144. ],
  145. btnLoad: false,
  146. apply_edit: false,
  147. id:0,
  148. remark:'',
  149. check_remark:'',
  150. check_status:'1',
  151. export_url: 'cloud-stock/equal-award/index', // 导出路径
  152. exportList: {},
  153. searchInfo: {
  154. active_name: 'settlement',
  155. },
  156. tabs: [
  157. {
  158. label: "已结算",
  159. name: "settlement",
  160. },
  161. {
  162. label: "未结算",
  163. name: "noSettlement",
  164. },
  165. ],
  166. activeName: 'settlement',
  167. apiParams:{
  168. r: 'cloud-stock/equal-award/index',
  169. active_name: 'settlement',
  170. },
  171. statistic: [
  172. {
  173. title: '待结算平级奖',
  174. value: 0,
  175. precision: 2,
  176. },
  177. {
  178. title: '已结算平级奖',
  179. value: 0,
  180. precision: 2,
  181. },
  182. ],
  183. multipleSelection: []
  184. },
  185. mounted() {
  186. this.getExportList();
  187. },
  188. methods: {
  189. getExportList() {
  190. this.listLoading = true;
  191. let params = {
  192. r: 'cloud-stock/equal-award/get-export-list',
  193. };
  194. request({
  195. params: params,
  196. method: 'get',
  197. }).then(e => {
  198. if (e.data.code == 0) {
  199. this.exportList = e.data.data;
  200. } else {
  201. this.$message.error(e.data.msg);
  202. }
  203. }).catch(e => {
  204. this.loading = false;
  205. });
  206. },
  207. handleSelectionChange(val) {
  208. this.multipleSelection = val;
  209. },
  210. handleSearch(keyword) {
  211. this.searchInfo = keyword;
  212. this.searchInfo.active_name = this.activeName;
  213. },
  214. setActionName(val) {
  215. this.searchInfo.active_name = val;
  216. this.activeName = val
  217. this.$set(this.apiParams, "active_name", val)
  218. this.$refs.table.handleSearch();
  219. },
  220. getApiData(data) {
  221. this.statistic[0].value = data.no_settlement;
  222. this.statistic[1].value = data.settlement
  223. },
  224. manualSettlement() {
  225. if (this.multipleSelection.length <= 0) {
  226. this.$message.error('请选择要结算的平级奖');
  227. return;
  228. }
  229. var ids = [];
  230. for (let i = 0; i < this.multipleSelection.length; i++) {
  231. ids.push(this.multipleSelection[i].id);
  232. }
  233. let self = this;
  234. self.$confirm('是否结算已选中数据, 是否继续?', '提示', {
  235. confirmButtonText: '确定',
  236. cancelButtonText: '取消',
  237. type: 'warning'
  238. }).then(() => {
  239. self.listLoading = true;
  240. request({
  241. params: {
  242. r: 'cloud-stock/equal-award/manual-settlement',
  243. },
  244. method: 'post',
  245. data: {
  246. id: ids,
  247. }
  248. }).then(e => {
  249. self.listLoading = false;
  250. if (e.data.code === 0) {
  251. self.$message.success(e.data.msg);
  252. this.$refs.table.getList();
  253. } else {
  254. self.$message.error(e.data.msg);
  255. }
  256. }).catch(e => {
  257. console.log(e);
  258. });
  259. }).catch(() => {
  260. self.$message.info('已取消删除')
  261. });
  262. }
  263. }
  264. })
  265. </script>