storeProduct.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div class="app-container">
  3. <div class="app-content">
  4. <div class="title" style="display: flex; justify-content: center; align-items: center;">药品销售统计</div>
  5. <el-form class="search-form" :inline="true" label-width="90px">
  6. <el-form-item label="统计">
  7. <el-select v-model="queryParams.type" placeholder="请选择日期" size="small">
  8. <el-option
  9. v-for="item in options"
  10. :key="item.value"
  11. :label="item.label"
  12. :value="item.value">
  13. </el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  18. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  19. </el-form-item>
  20. </el-form>
  21. </div>
  22. <el-button class="export" size="small" @click="handleExport" style="float: right; margin-bottom: 15px; margin-right: 40px;" >导出</el-button>
  23. <div class="table-box" style="margin-left: 40px; margin-right: 40px;">
  24. <el-table
  25. :data="list"
  26. border
  27. show-summary
  28. style="width: 100%;" class="centered-table">
  29. <el-table-column
  30. label="商品名称" >
  31. <template slot-scope="scope">
  32. <span>{{ JSON.parse(scope.row.json).productName}}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column
  36. label="商品编号" >
  37. <template slot-scope="scope">
  38. <span>{{ JSON.parse(scope.row.json).barCode}}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column
  42. label="组合编号" >
  43. <template slot-scope="scope">
  44. <span>{{ JSON.parse(scope.row.json).groupBarCode}}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column
  48. label="单价" >
  49. <template slot-scope="scope">
  50. <span>{{ JSON.parse(scope.row.json).price}}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column
  54. label="销售金额" >
  55. <template slot-scope="scope">
  56. <span>{{ JSON.parse(scope.row.json).price * scope.row.num}}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. prop="num"
  61. label="销售数量" >
  62. </el-table-column>
  63. </el-table>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import { storeProduct,exportStoreProduct } from "@/api/company/statistics";
  69. export default {
  70. data() {
  71. return {
  72. exportLoading: false,
  73. queryParams:{
  74. type: "9",
  75. storeId: null,
  76. },
  77. options: [{
  78. value: '1',
  79. label: '今天'
  80. }, {
  81. value: '2',
  82. label: '昨天'
  83. }, {
  84. value: '3',
  85. label: '本周'
  86. }, {
  87. value: '4',
  88. label: '上周'
  89. }, {
  90. value: '5',
  91. label: '本月'
  92. }
  93. , {
  94. value: '6',
  95. label: '上月'
  96. },
  97. {
  98. value: '7',
  99. label: '本季度'
  100. },
  101. {
  102. value: '8',
  103. label: '上季度'
  104. }
  105. , {
  106. value: '9',
  107. label: '本年'
  108. }
  109. , {
  110. value: '10',
  111. label: '去年'
  112. }],
  113. list:[],
  114. storeOPtions:[],
  115. chart: null,
  116. data: [
  117. ],
  118. };
  119. },
  120. created() {
  121. storeProduct(this.queryParams).then(response => {
  122. this.list = response.list;
  123. });
  124. },
  125. methods: {
  126. /** 导出按钮操作 */
  127. handleExport() {
  128. const queryParams = this.queryParams;
  129. this.$confirm('是否确认导出所有数据?', "警告", {
  130. confirmButtonText: "确定",
  131. cancelButtonText: "取消",
  132. type: "warning"
  133. }).then(() => {
  134. this.exportLoading = true;
  135. return exportStoreProduct(queryParams);
  136. }).then(response => {
  137. this.download(response.msg);
  138. this.exportLoading = false;
  139. }).catch(() => {});
  140. },
  141. handleQuery(){
  142. storeProduct(this.queryParams).then(response => {
  143. this.list = response.list;
  144. });
  145. },
  146. /** 重置按钮操作 */
  147. resetQuery() {
  148. this.queryParams={
  149. type: null,
  150. storeId: null,
  151. }
  152. this.getorderChartData()
  153. },
  154. },
  155. };
  156. </script>
  157. <style>
  158. .title{
  159. padding: 20px 30px 0px 30px;
  160. font-size: 18px;
  161. font-weight: bold;
  162. color: black;
  163. }
  164. .search-form{
  165. margin: 20px 30px 0px 30px;
  166. }
  167. .echart-box{
  168. margin: 0 auto;
  169. text-align: center;
  170. }
  171. .el-select{
  172. margin: 5px 10px;
  173. }
  174. .table-box{
  175. margin-top: 15px;
  176. .export{
  177. float: right;
  178. margin: 10px 0px;
  179. }
  180. }
  181. .app-container{
  182. border: 1px solid #e6e6e6;
  183. padding: 12px;
  184. }
  185. .app-content{
  186. background-color: white;
  187. }
  188. .data-box{
  189. padding: 30px;
  190. background-color: rgb(255, 255, 255);
  191. height: 100%;
  192. }
  193. .centered-table .cell {
  194. text-align: center;
  195. }
  196. </style>