recharge.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div class="formContent">
  3. <div>
  4. <h3>{{this.userName}}</h3>
  5. <div class="formContent-item_title">充值信息</div>
  6. <el-row>
  7. <el-col :span="12">
  8. <el-col :span="8">车牌类型</el-col>
  9. <el-col :span="12">月租车</el-col>
  10. </el-col>
  11. <!-- 充值类型 -->
  12. <el-col :span="24">
  13. <el-col :span="4">费用类型</el-col>
  14. <el-col :span="20">
  15. <el-select v-model="valueselected">
  16. <el-option
  17. v-for="(item,index) in recharge"
  18. :key="index"
  19. :value="item.label"
  20. :label="item.name"
  21. @click.native="rechargeDates(item)"
  22. >
  23. </el-option>
  24. </el-select>
  25. </el-col>
  26. </el-col>
  27. <!-- 充值 -->
  28. <el-col :span="24">
  29. <el-col :span="12">
  30. <el-col :span="8">充值天数</el-col>
  31. <el-col :span="16">
  32. <el-select v-model="rechargeDays">
  33. <el-option
  34. v-for="(itemes,indexes) in RechargeDaysed"
  35. :key="indexes"
  36. :value="itemes.name"
  37. :label="itemes.label"
  38. @click.native="recharges(itemes)"
  39. ></el-option>
  40. </el-select>
  41. </el-col>
  42. </el-col>
  43. <el-col :span="12">
  44. <el-col :span="8">赠送天数</el-col>
  45. <el-col :span="16">
  46. <el-select
  47. disabled
  48. :placeholder='valueselect'
  49. >
  50. </el-select>
  51. </el-col>
  52. </el-col>
  53. </el-col>
  54. <!-- 日期 -->
  55. <el-col :span="24">
  56. <el-col :span="4">开始时间</el-col>
  57. <el-col :span="20">
  58. <el-date-picker
  59. v-model="value1"
  60. type="date"
  61. placeholder="选择日期"
  62. value-format="timestamp"
  63. @change="datePicker"
  64. >
  65. </el-date-picker>
  66. </el-col>
  67. </el-col>
  68. <el-col :span="24">
  69. <el-col :span="4">结束时间</el-col>
  70. <el-col :span="20">
  71. <el-date-picker
  72. v-model="value2"
  73. type="date"
  74. :placeholder="value2"
  75. value-format="timestamp"
  76. disabled
  77. >
  78. </el-date-picker>
  79. </el-col>
  80. <el-col :span="24">
  81. <span>车辆未过期,已绑定充值规则,充值开始时间:过期时间+1</span>
  82. </el-col>
  83. </el-col>
  84. <!-- 收费金额 -->
  85. <el-col :span="24">
  86. <el-col :span="4">收费金额 </el-col>
  87. <el-col :span="17">
  88. <el-input
  89. :placeholder="chargeAmount"
  90. :disabled="true"
  91. >
  92. </el-input>
  93. </el-col>
  94. <el-col
  95. :span="2"
  96. style="margin-left: 5px;"
  97. >元 </el-col>
  98. </el-col>
  99. <!-- 支付方式 -->
  100. <el-col :span="24">
  101. <el-col :span="4">支付方式</el-col>
  102. <el-col :span="20">
  103. <el-select
  104. v-model="paymentMethod"
  105. placeholder="请选择"
  106. >
  107. <el-option
  108. value="1"
  109. label="现金"
  110. ></el-option>
  111. <el-option
  112. value="2"
  113. label="微信"
  114. ></el-option>
  115. <el-option
  116. value="3"
  117. label="支付宝"
  118. ></el-option>
  119. </el-select>
  120. </el-col>
  121. </el-col>
  122. <!-- 备注 -->
  123. <el-col :span="24">
  124. <el-col :span="4">充值备注</el-col>
  125. <el-col :span="20">
  126. <el-input
  127. type="textarea"
  128. :rows="3"
  129. placeholder="请输入内容"
  130. v-model="inputText"
  131. maxlength="100"
  132. show-word-limit
  133. ></el-input>
  134. </el-col>
  135. </el-col>
  136. </el-row>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. export default {
  142. props: ['params'],
  143. data () {
  144. return {
  145. valueselected: '',
  146. valueselect: '',//天数
  147. value1: '',//日期时间
  148. value2: '',
  149. rechargeDays: '',//充值时间
  150. chargeAmount: '',//收费金额
  151. paymentMethod: '',//支付方式
  152. inputText: '',//备注
  153. id: '',
  154. userName: "",
  155. cardType: "",
  156. parkId: "",
  157. cardId: "",
  158. recharge: [],
  159. RechargeDaysed: [],
  160. complimentaryDays: [],
  161. idType: '',
  162. valueselectName: "",
  163. chargeNumber: '',
  164. timeValue1: '',
  165. timeValue2: '',
  166. rechargeDate: [],
  167. }
  168. },
  169. methods: {
  170. rechargeDates (item) {
  171. debugger
  172. // item.nameId
  173. // this.rechargeDate[item.nameId]
  174. // this.valueselected = '';
  175. this.rechargeDays = '';
  176. this.valueselect = '';
  177. this.valueselectName = '';
  178. this.idType = '';
  179. this.chargeAmount = '';
  180. this.chargeNumber = '';
  181. this.RechargeDaysed = [];
  182. this.complimentaryDays = [];
  183. this.RechargeDaysed.push({
  184. label: this.rechargeDate[item.nameId].rechargeAmount * (this.rechargeDate[item.nameId].rechargeType == 0 ? (1 * 1 / 100) : this.rechargeDate[item.nameId].rechargeType == 1 ? (1 * 1) : this.rechargeDate[item.nameId].rechargeType == 2 ? (1 * 1) : this.rechargeDate[item.nameId].rechargeType == 3 ? (1 * 1) : (1 * 1)) + (this.rechargeDate[item.nameId].rechargeType == 0 ? '元' : this.rechargeDate[item.nameId].rechargeType == 1 ? '月' : this.rechargeDate[item.nameId].rechargeType == 2 ? '天' : this.rechargeDate[item.nameId].rechargeType == 3 ? '小时' : '次'),
  185. name: this.rechargeDate[item.nameId].rechargeAmount * (this.rechargeDate[item.nameId].rechargeType == 0 ? (1 * 1 / 100) : this.rechargeDate[item.nameId].rechargeType == 1 ? (1 * 1) : this.rechargeDate[item.nameId].rechargeType == 2 ? (1 * 1) : this.rechargeDate[item.nameId].rechargeType == 3 ? (1 * 1) : (1 * 1)),
  186. id: item.nameId,
  187. })
  188. this.complimentaryDays.push({
  189. idType: this.rechargeDate[item.nameId].rechargeType,
  190. name: this.rechargeDate[item.nameId].sentAmount * (this.rechargeDate[item.nameId].sentType == 0 ? (1 * 1 / 100) : this.rechargeDate[item.nameId].sentType == 1 ? (1 * 1) : this.rechargeDate[item.nameId].sentType == 2 ? (1 * 1) : this.rechargeDate[item.nameId].sentType == 3 ? (1 * 1) : (1 * 1)),
  191. label: this.rechargeDate[item.nameId].sentAmount * (this.rechargeDate[item.nameId].sentType == 0 ? (1 * 1 / 100) : this.rechargeDate[item.nameId].sentType == 1 ? (1 * 1) : this.rechargeDate[item.nameId].sentType == 2 ? (1 * 1) : this.rechargeDate[item.nameId].sentType == 3 ? (1 * 1) : (1 * 1)) + (this.rechargeDate[item.nameId].sentType == 0 ? '元' : this.rechargeDate[item.nameId].sentType == 1 ? '月' : this.rechargeDate[item.nameId].sentType == 2 ? '天' : this.rechargeDate[item.nameId].sentType == 3 ? '小时' : '次'),
  192. chargeAmount: this.rechargeDate[item.nameId].basicMoney
  193. })
  194. debugger
  195. },
  196. datePicker () {
  197. // valueselect赠送
  198. // rechargeDays 天数
  199. if (this.idType == 0) {
  200. var time = this.value1;
  201. } else if (this.idType == 1) {
  202. debugger
  203. var time = ((parseInt(this.valueselectName) + parseInt(this.rechargeDays * 30)) * 86400000) + this.value1;
  204. } else if (this.idType == 2) {
  205. var time = ((parseInt(this.valueselectName) + parseInt(this.rechargeDays)) * 86400000) + this.value1;
  206. } else if (this.idType == 3) {
  207. var time = ((parseInt(this.valueselectName) + parseInt(this.rechargeDays)) * 3600000) + this.value1;
  208. } else if (this.idType == 4) {
  209. var time = this.value1;
  210. }
  211. // var time = ((parseInt(this.valueselected) + parseInt(this.rechargeDays)) * 86400000) + this.value1;
  212. var timeCode = new Date(time);
  213. var year = timeCode.getFullYear();
  214. var month = timeCode.getMonth() + 1;
  215. var date = timeCode.getDate();
  216. this.value2 = year + "-" + (month.toString().length == 1 ? ('0' + month) : month) + "-" + (date.toString().length == 1 ? ('0' + date) : date);
  217. var timeCodes = new Date(this.value1);
  218. var year = timeCodes.getFullYear();
  219. var month = timeCodes.getMonth() + 1;
  220. var date = timeCodes.getDate();
  221. this.timeValue1 = year + "-" + (month.toString().length == 1 ? ('0' + month) : month) + "-" + (date.toString().length == 1 ? ('0' + date) : date) + ' ' + '00:00:00';
  222. this.timeValue2 = this.value2 + ' ' + '23:59:59';
  223. },
  224. // 充值规则
  225. rechargeRules () {
  226. // /sc-community-web/parkingCar/queryRechargeRules
  227. this.$http
  228. .get('/sc-community-web/parkingCar/queryRechargeRules', { carType: this.cardType, parkingId: this.parkId })
  229. .then(({ data, msg, status }) => {
  230. console.log('data', data);
  231. this.rechargeDate = data;
  232. for (let i = 0; i < data.length; i++) {
  233. this.recharge.push({
  234. name: data[i].ruleName,
  235. label: data[i].ruleId,
  236. nameId: i
  237. })
  238. }
  239. })
  240. .catch(() => { });
  241. },
  242. recharges (item) {
  243. debugger
  244. this.id = item.id;
  245. this.valueselect = this.complimentaryDays[0].label;
  246. this.valueselectName = this.complimentaryDays[0].name;
  247. this.idType = this.complimentaryDays[0].idType;
  248. this.chargeAmount = this.complimentaryDays[0].chargeAmount;
  249. this.chargeNumber = item.name;
  250. },
  251. submit () {
  252. this.$http.post('/sc-community-web/parkingCar/carCharge', {
  253. amount: this.chargeAmount,
  254. carType: this.cardType,
  255. cardId: this.cardId,
  256. chargeMethod: this.idType,
  257. chargeNumber: this.chargeNumber,
  258. freeNumber: this.valueselectName,
  259. // orderNo: '',
  260. parkId: this.parkId,
  261. payChannel: this.paymentMethod,
  262. remark: this.inputText,
  263. validFrom: this.timeValue1,
  264. validTo: this.timeValue2
  265. }).then(({ data, status, msg }) => {
  266. })
  267. this.$emit('close');
  268. },
  269. },
  270. created () {
  271. console.log('11111')
  272. this.params;
  273. this.userName = this.params.userName;
  274. this.cardType = this.params.cardType;
  275. this.parkId = this.params.parkId;
  276. this.cardId = this.params.cardId;
  277. this.rechargeRules();
  278. }
  279. }
  280. </script>
  281. <style scoped>
  282. h3 {
  283. margin-bottom: 15px;
  284. }
  285. .el-col {
  286. margin-top: 10px !important;
  287. line-height: 30px;
  288. }
  289. .el-select {
  290. width: 90%;
  291. }
  292. .el-col > span {
  293. font-size: 12px;
  294. font-weight: 400;
  295. color: #ff7171;
  296. line-height: 17px;
  297. display: flex;
  298. justify-content: center;
  299. }
  300. </style>