index.vue 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div class="subPage">
  3. <div class="system-table-search">
  4. <div class="flex-h">
  5. <ul class="searchFilterLine" style="white-space: normal;">
  6. <li>
  7. <el-select v-model="postData.caseid" placeholder="请选择案场">
  8. <el-option
  9. v-for="item in cases"
  10. :key="item.CaseId"
  11. :label="item.CaseName"
  12. :value="item.CaseId">
  13. </el-option>
  14. </el-select>
  15. </li>
  16. <li>
  17. <el-select v-model="postData.usertype" placeholder="请选择下单用户类型">
  18. <el-option
  19. v-for="item in typeList"
  20. :key="item.id"
  21. :label="item.value"
  22. :value="item.id">
  23. </el-option>
  24. </el-select>
  25. </li>
  26. <li>
  27. <el-select v-model="postData.status" placeholder="请选择订单状态">
  28. <el-option
  29. v-for="item in statusList"
  30. :key="item.id"
  31. :label="item.value"
  32. :value="item.id">
  33. </el-option>
  34. </el-select>
  35. </li>
  36. <li style="white-space: nowrap;">
  37. <span>下单时间:</span>
  38. <el-date-picker
  39. value-format="yyyy-MM-dd"
  40. v-model="postData.begindate"
  41. type="date"
  42. placeholder="选择起始日期">
  43. </el-date-picker>
  44. <span>至</span>
  45. <el-date-picker
  46. value-format="yyyy-MM-dd"
  47. v-model="postData.enddate"
  48. type="date"
  49. placeholder="选择截止日期">
  50. </el-date-picker>
  51. </li>
  52. </ul>
  53. </div>
  54. <div class="flex-h">
  55. <div class="flex-item flex-h"></div>
  56. <el-button
  57. size="mini"
  58. type="primary" @click="search">搜索</el-button>
  59. <el-button
  60. size="mini"
  61. type="success" @click="exportExcel">导出Excel</el-button>
  62. </div>
  63. <div class="moreFilter"></div>
  64. </div>
  65. <table>
  66. <tr v-for="(item,index) in goodsOrderList.length*2" :key="index">
  67. <td v-if="index%2 === 0" colspan="16" class="title">
  68. <div class="flex-h">
  69. <div class="flex-item" style="text-align:left;">
  70. <span>订单编号:{{returnListItem(goodsOrderList, index).OrdersNo}}</span>
  71. <span>案场:{{returnListItem(goodsOrderList, index).CaseName}}</span>
  72. <span>用户类型:{{returnListItem(goodsOrderList, index).UserType === 'sales' ? '销售' : returnListItem(goodsOrderList, index).UserType === 'manager' ? '主管' : '用户'}}</span>
  73. <span>下单时间:{{toolClass.dateFormat(returnListItem(goodsOrderList, index).CreateDate)}}</span>
  74. </div>
  75. <span>{{returnStatus(returnListItem(goodsOrderList, index).MakeStatus)}}</span>
  76. </div>
  77. </td>
  78. <td v-if="index%2 !== 0" colspan="4" class="noborder">
  79. <span v-for="(subItem,subIndex) in returnListItem(goodsOrderList, index).Details" :key="subIndex">{{subItem.GoodsName}}({{subItem.SpecName}})</span>
  80. </td>
  81. <td v-if="index%2 !== 0" colspan="1" class="noborder">
  82. <span v-for="(subItem,subIndex) in returnListItem(goodsOrderList, index).Details" :key="subIndex">x{{subItem.Number}}</span>
  83. </td>
  84. <td v-if="index%2 !== 0" colspan="1" class="noborder">
  85. <span v-for="(subItem,subIndex) in returnListItem(goodsOrderList, index).Details" :key="subIndex">¥{{subItem.Price}}</span>
  86. </td>
  87. <td v-if="index%2 !== 0" colspan="4">
  88. <span>{{returnListItem(goodsOrderList, index).AreaName}}{{returnListItem(goodsOrderList, index).TableNo}}</span>
  89. </td>
  90. <td v-if="index%2 !== 0" colspan="4">
  91. <span>{{returnListItem(goodsOrderList, index).Name}}/{{returnListItem(goodsOrderList, index).Phone}}</span>
  92. </td>
  93. <td v-if="index%2 !== 0" colspan="2">
  94. <el-button
  95. size="mini"
  96. type="success" @click="printPdf(`item${(index + 1) / 2}`)">重打</el-button>
  97. </td>
  98. <div v-if="index%2 !== 0" class="print-area" :class="'item' + (index + 1) / 2" style="width:180px;left:0;position: absolute;opacity: 0;">
  99. <div style="padding:0px 10px 5px;border-bottom:2px solid #cccccc;">
  100. <div style="display:inline-block;">
  101. <img class="topIcon" style="display:block;width:60%;margin:0 0 20px 0px;" src="http://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/upload/111101940020.png" alt="">
  102. <span style="display:block;font-size:20px;font-weight:700;text-align: center;">{{returnListItem(goodsOrderList, index).AreaName}}{{returnListItem(goodsOrderList, index).TableNo}}</span>
  103. </div>
  104. </div>
  105. <div style="padding:10px 10px 5px;border-bottom:1px solid #cccccc;" v-for="(subItem,subIndex) in returnListItem(goodsOrderList, index).Details" :key="subIndex">
  106. <div style="font-size:12px;"><span style="display:inline-block;width:75%;text-align:left;">{{subItem.GoodsName}}</span><span style="display:inline-block;width:22%;text-align:right;font-size:12px;" v-if='!subItem.SpecName'>× {{subItem.Number}}</span></div>
  107. <div style="margin-top:8px;" v-if='subItem.SpecName'>
  108. <span style="display:inline-block;width:75%;text-align:left;color:#cccccc;font-size:12px;">{{subItem.SpecName}}</span>
  109. <span style="display:inline-block;width:20%;text-align:right;font-size:12px;">× {{subItem.Number}}</span>
  110. </div>
  111. </div>
  112. <div style="padding:10px 10px 5px;border-bottom:1px solid #cccccc;">
  113. <div style="font-size:12px;">下单人:{{returnListItem(goodsOrderList, index).CustomerName}}</div>
  114. <span style="display:block;margin-top:10px;font-size:12px;">下单时间:{{toolClass.dateFormat(returnListItem(goodsOrderList, index).CreateDate)}}</span>
  115. </div>
  116. <div style="padding:10px 10px;font-size:12px;">备注:{{item.Remark}}</div>
  117. <div style="text-align: right;font-size: 12px;">城的空间.诚咖啡</div>
  118. <div style="height:10px"></div>
  119. </div>
  120. </tr>
  121. </table>
  122. <el-pagination
  123. @current-change="handleCurrentChange"
  124. :current-page.sync="postData.page"
  125. :page-size="postData.pagesize"
  126. layout="prev, pager, next, jumper"
  127. :total="total">
  128. </el-pagination>
  129. </div>
  130. </template>
  131. <script>
  132. import { mapState, createNamespacedHelpers } from 'vuex'
  133. import { getLodop } from '@/util/LodopFuncs'
  134. import tableSearch from '@/components/tableSearch/index'
  135. const { mapState: mapStaState, mapActions: mapStaActions } = createNamespacedHelpers('sta')
  136. var LODOP
  137. export default {
  138. name: '',
  139. data () {
  140. return {
  141. total: 0,
  142. postData: { // 表格搜索条件
  143. status: '', // 状态
  144. caseid: '', // 案场id
  145. usertype: '', // 用户类型
  146. begindate: '', // 起始日期
  147. enddate: '', // 截止日期
  148. page: 1, // 当前页码
  149. pagesize: 10, // 请求数据量
  150. },
  151. typeList: [{
  152. value: '',
  153. id: ''
  154. }, {
  155. value: '销售',
  156. id: 'sales'
  157. }, {
  158. value: '主管',
  159. id: 'manager'
  160. }, {
  161. value: '用户',
  162. id: 'customer'
  163. }],
  164. statusList: [{
  165. value: '',
  166. id: ''
  167. }, {
  168. value: '已下单',
  169. id: 'not started'
  170. }, {
  171. value: '制作中',
  172. id: 'doing'
  173. }, {
  174. value: '已完成',
  175. id: 'finished'
  176. }, {
  177. value: '已取消',
  178. id: 'cancel'
  179. }],
  180. }
  181. },
  182. computed: {
  183. ...mapState({
  184. cases: x => x.app.cases.list,
  185. defaultCaseId: x => x.app.cases.default
  186. }),
  187. ...mapStaState({
  188. goodsOrderList: x => x.goodsOrder.list || [],
  189. }),
  190. CaseId: {
  191. get () {
  192. return this.postData.caseid || this.defaultCaseId
  193. },
  194. set (val) {
  195. this.postData.caseid = val
  196. }
  197. }
  198. },
  199. components: {
  200. tableSearch,
  201. },
  202. mounted () {
  203. this.$nextTick(function () {
  204. this.getList()
  205. })
  206. },
  207. methods: {
  208. ...mapStaActions([
  209. 'getGoodsOrderList',
  210. ]),
  211. returnStatus (val) {
  212. switch (val) {
  213. case 'not started':
  214. return '已下单'
  215. case 'doing':
  216. return '制作中'
  217. case 'finished':
  218. return '已完成'
  219. case 'cancel':
  220. return '已取消'
  221. }
  222. },
  223. returnListItem (target, index) {
  224. return target[Math.ceil((index + 1) / 2) - 1]
  225. },
  226. search () { // 搜索
  227. this.page = 1
  228. this.getList()
  229. },
  230. handleCurrentChange (val) { // 跳转到分页
  231. this.page = val
  232. this.getList()
  233. },
  234. getList () {
  235. this.getGoodsOrderList(this.postData).then((res) => {
  236. // console.log(JSON.stringify(res))
  237. this.postData.page = res.page
  238. this.total = res.total
  239. })
  240. },
  241. printPdf (cl) {
  242. this.CreateOneFormPage(cl)
  243. LODOP.PRINT()
  244. // LODOP.PREVIEW()
  245. },
  246. CreateOneFormPage (cl) {
  247. LODOP = getLodop()
  248. LODOP.PRINT_INIT('订单')
  249. LODOP.SET_PRINT_PAGESIZE(3, 480, 40, '')
  250. LODOP.ADD_PRINT_HTM(0, 0, document.getElementsByClassName(cl)[0].offsetWidth, document.getElementsByClassName(cl)[0].offsetHeight, document.getElementsByClassName(cl)[0].innerHTML)
  251. },
  252. exportExcel () {
  253. window.location.href = `${this.toolClass.ReplaceOrg(this.$api.statistics.goodsOrderExcel.url)}?token=${localStorage.getItem('JWT')}`
  254. },
  255. }
  256. }
  257. </script>
  258. <!-- Add "scoped" attribute to limit CSS to this component only -->
  259. <style lang="scss" scoped>
  260. @import "page.scss";
  261. .searchFilterLine {
  262. > li {
  263. margin-bottom: 20px;
  264. }
  265. }
  266. </style>