housePriceSchemeDetailList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <a-card :bordered="false" :schemeId="schemeId">
  3. <a-radio-group v-model="tablemode" :style="{ marginBottom: '8px' }">
  4. <a-radio-button value="ordinaryDays">平日房价</a-radio-button>
  5. <a-radio-button value="weekend">周末房价</a-radio-button>
  6. </a-radio-group>
  7. <div>
  8. <a-table ref="table" size="middle" :scroll="{ x: true }" bordered rowKey="id" :columns="columns"
  9. :dataSource="dataSource" :pagination="ipagination" :loading="loading" :rowSelection="{
  10. selectedRowKeys: selectedRowKeys,
  11. onChange: onSelectChange,
  12. }" class="j-table-force-nowrap" @change="handleTableChange"
  13. :rowKey="(record, index) => index + 1">
  14. <template slot="openSlot" slot-scope="text, record, index">
  15. <a-switch checked-children="开" un-checked-children="关" default-checked :checked="record.open == 1"
  16. @change="e=>changeOpenState(e,record)" />
  17. </template>
  18. <template slot="moneySlot" slot-scope="text, record">
  19. <div>
  20. <a-input-number v-model="record.money" :step="1" :min="0" :precision="2"
  21. @blur="onMoneyChange(record)" />
  22. </div>
  23. </template>
  24. <template slot="breakfastNumberSlot" slot-scope="text, record">
  25. <div>
  26. <a-input-number v-model="record.breakfastNumber" :step="1" :min="0" :precision="0"
  27. @blur="onNumberChange(record)" />
  28. </div>
  29. </template>
  30. <template slot="departureTimeSlot" slot-scope="text, record">
  31. <div>
  32. <a-time-picker :default-value="moment(record.departureTime, 'HH:mm')" format="HH:mm"
  33. @change="e=>onDepartureTimeChange(e,record)">
  34. </a-time-picker>
  35. </div>
  36. </template>
  37. <template slot="imgSlot" slot-scope="text, record">
  38. <span v-if="!text" style="font-size: 12px; font-style: italic">无图片</span>
  39. <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
  40. style="max-width: 80px; font-size: 12px; font-style: italic" />
  41. </template>
  42. <template slot="fileSlot" slot-scope="text">
  43. <span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
  44. <a-button v-else :ghost="true" type="primary" icon="download" size="small"
  45. @click="downloadFile(text)">
  46. 下载
  47. </a-button>
  48. </template>
  49. <span slot="action" slot-scope="text, record">
  50. <a @click="handleReset(record)">重置</a>
  51. <a @click="handleMoney(record)">房价日历</a>
  52. </span>
  53. </a-table>
  54. </div>
  55. <house-price-scheme-layout-modal ref="modalForm" @ok="modalFormOk"></house-price-scheme-layout-modal>
  56. </a-card>
  57. </template>
  58. <script>
  59. import '@/assets/less/TableExpand.less'
  60. import { mixinDevice } from '@/utils/mixin'
  61. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  62. import moment from 'moment';
  63. import { httpAction } from '@/api/manage'
  64. import HousePriceSchemeLayoutModal from "./housePriceSchemeLayout/housePriceSchemeLayoutModal";
  65. export default {
  66. name: 'housePriceSchemeDetailList',
  67. mixins:[JeecgListMixin, mixinDevice],
  68. components: {
  69. HousePriceSchemeLayoutModal
  70. },
  71. props: {
  72. schemeId: {
  73. type: String,
  74. default: () => {
  75. return ""
  76. }
  77. }
  78. },
  79. data () {
  80. return {
  81. description: '房价方案-房型关联表管理页面',
  82. // 表头
  83. columns: [
  84. {
  85. title: "序号",
  86. align: 'center',
  87. customRender: (text, record, index) => index + 1,
  88. },
  89. {
  90. title:'房型',
  91. align:"center",
  92. dataIndex: 'layoutName'
  93. },
  94. {
  95. title:'间数(间)1',
  96. align:"center",
  97. dataIndex: 'layoutName'
  98. },
  99. // {
  100. // title:'门市价',
  101. // align:"center",
  102. // dataIndex: 'layoutPrice'
  103. // },
  104. {
  105. title:'挂牌价(元)1',
  106. align:"center",
  107. dataIndex: 'layoutPrice'
  108. },
  109. {
  110. title:'前台价(散客)1',
  111. align:"center",
  112. dataIndex: 'layoutPrice'
  113. },
  114. {
  115. title:'微信小程序(散客)1',
  116. align:"center",
  117. dataIndex: 'layoutPrice'
  118. },
  119. {
  120. title:'钟点房间(元/小时)1',
  121. align:"center",
  122. dataIndex: 'layoutPrice'
  123. },
  124. // {
  125. // title:'执行房价',
  126. // align:"center",
  127. // dataIndex: 'money',
  128. // scopedSlots: {customRender: "moneySlot"},
  129. // },
  130. // {
  131. // title:'早餐数量',
  132. // align:"center",
  133. // dataIndex: 'breakfastNumber',
  134. // scopedSlots: {customRender: "breakfastNumberSlot"},
  135. // },
  136. // {
  137. // title:'默认离店时间',
  138. // align:"center",
  139. // dataIndex: 'departureTime',
  140. // // customRender:function (text) {
  141. // // return !text?"":(text.length>10?text.substr(0,10):text)
  142. // // },
  143. // scopedSlots: {customRender: "departureTimeSlot"},
  144. // },
  145. {
  146. title: '查看每日房价',
  147. dataIndex: 'action',
  148. align:"center",
  149. fixed:"right",
  150. width:147,
  151. scopedSlots: { customRender: 'action' }
  152. }
  153. ],
  154. url: {
  155. list: "/business/busHousePriceSchemeLayout/list",
  156. delete: "/business/busHousePriceSchemeLayout/delete",
  157. deleteBatch: "/business/busHousePriceSchemeLayout/deleteBatch",
  158. exportXlsUrl: "/business/busHousePriceSchemeLayout/exportXls",
  159. importExcelUrl: "business/busHousePriceSchemeLayout/importExcel",
  160. editMoney: "/business/busHousePriceSchemeLayout/editMoney",
  161. editNumber: "/business/busHousePriceSchemeLayout/editNumber",
  162. editTime: "/business/busHousePriceSchemeLayout/editTime",
  163. },
  164. dictOptions:{},
  165. superFieldList:[],
  166. queryParam: {
  167. schemeId: this.schemeId
  168. },
  169. tablemode: 'ordinaryDays'
  170. }
  171. },
  172. created() {
  173. this.getSuperFieldList();
  174. },
  175. computed: {
  176. importExcelUrl: function(){
  177. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  178. },
  179. },
  180. methods: {
  181. moment,
  182. initDictConfig(){
  183. },
  184. getSuperFieldList(){
  185. let fieldList=[];
  186. fieldList.push({type:'string',value:'tenantId',text:'关联租户'})
  187. fieldList.push({type:'string',value:'hotelId',text:'关联酒店'})
  188. fieldList.push({type:'string',value:'schemeId',text:'关联房价方案'})
  189. fieldList.push({type:'string',value:'layoutId',text:'关联房型'})
  190. fieldList.push({type:'number',value:'money',text:'执行房价'})
  191. fieldList.push({type:'date',value:'departureTime',text:'默认离店时间'})
  192. fieldList.push({type:'int',value:'breakfastNumber',text:'早餐数量'})
  193. fieldList.push({type:'int',value:'lunchNumber',text:'中餐数量'})
  194. fieldList.push({type:'int',value:'dinnerNumber',text:'晚餐数量'})
  195. fieldList.push({type:'int',value:'delFlag',text:'删除状态'})
  196. this.superFieldList = fieldList
  197. },
  198. onMoneyChange(record){
  199. var that = this;
  200. //修改执行房价
  201. var param = {
  202. money: record.money,
  203. id: record.id
  204. }
  205. console.log(param)
  206. httpAction(this.url.editMoney, param, 'post').then((res) => {
  207. if (res.success) {
  208. that.$message.success('操作成功')
  209. that.$emit('ok')
  210. } else {
  211. that.$message.warning(res.message)
  212. }
  213. }).finally(() => {
  214. that.confirmLoading = false
  215. })
  216. },
  217. onNumberChange(record){
  218. //修改早餐数量
  219. var that = this;
  220. var param = {
  221. breakfastNumber: record.breakfastNumber,
  222. id: record.id
  223. }
  224. console.log(param)
  225. httpAction(this.url.editNumber, param, 'post').then((res) => {
  226. if (res.success) {
  227. that.$message.success('操作成功')
  228. that.$emit('ok')
  229. } else {
  230. that.$message.warning(res.message)
  231. }
  232. }).finally(() => {
  233. that.confirmLoading = false
  234. })
  235. },
  236. onDepartureTimeChange(e,record){
  237. var _time = moment(new Date(e)).format('HH:mm:ss')
  238. console.log(_time)
  239. //修改时间
  240. var that = this;
  241. var param = {
  242. departureTime: _time,
  243. id: record.id
  244. }
  245. console.log(param)
  246. httpAction(this.url.editTime, param, 'post').then((res) => {
  247. if (res.success) {
  248. that.$message.success('操作成功')
  249. that.$emit('ok')
  250. } else {
  251. that.$message.warning(res.message)
  252. }
  253. }).finally(() => {
  254. that.confirmLoading = false
  255. })
  256. },
  257. handleMoney(record){
  258. this.$refs.modalForm.title="每日房价"
  259. this.$refs.modalForm.visible = true
  260. this.$refs.modalForm.edit(record);
  261. },
  262. // 重置按钮
  263. handleReset() {
  264. }
  265. }
  266. }
  267. </script>
  268. <style scoped>
  269. </style>