recharge.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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.RechargeDaysed = [];
  175. this.complimentaryDays = [];
  176. this.RechargeDaysed.push({
  177. 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 ? '小时' : '次'),
  178. 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)),
  179. id: item.nameId,
  180. })
  181. this.complimentaryDays.push({
  182. idType: this.rechargeDate[item.nameId].rechargeType,
  183. 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)),
  184. 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 ? '小时' : '次'),
  185. chargeAmount: this.rechargeDate[item.nameId].basicMoney
  186. })
  187. debugger
  188. },
  189. datePicker () {
  190. // valueselect赠送
  191. // rechargeDays 天数
  192. if (this.idType == 0) {
  193. var time = this.value1;
  194. } else if (this.idType == 1) {
  195. debugger
  196. var time = ((parseInt(this.valueselectName) + parseInt(this.rechargeDays * 30)) * 86400000) + this.value1;
  197. } else if (this.idType == 2) {
  198. var time = ((parseInt(this.valueselectName) + parseInt(this.rechargeDays)) * 86400000) + this.value1;
  199. } else if (this.idType == 3) {
  200. var time = ((parseInt(this.valueselectName) + parseInt(this.rechargeDays)) * 3600000) + this.value1;
  201. } else if (this.idType == 4) {
  202. var time = this.value1;
  203. }
  204. // var time = ((parseInt(this.valueselected) + parseInt(this.rechargeDays)) * 86400000) + this.value1;
  205. var timeCode = new Date(time);
  206. var year = timeCode.getFullYear();
  207. var month = timeCode.getMonth() + 1;
  208. var date = timeCode.getDate();
  209. this.value2 = year + "-" + (month.toString().length == 1 ? ('0' + month) : month) + "-" + (date.toString().length == 1 ? ('0' + date) : date);
  210. var timeCodes = new Date(this.value1);
  211. var year = timeCodes.getFullYear();
  212. var month = timeCodes.getMonth() + 1;
  213. var date = timeCodes.getDate();
  214. this.timeValue1 = year + "-" + (month.toString().length == 1 ? ('0' + month) : month) + "-" + (date.toString().length == 1 ? ('0' + date) : date) + ' ' + '00:00:00';
  215. this.timeValue2 = this.value2 + ' ' + '23:59:59';
  216. },
  217. // 充值规则
  218. rechargeRules () {
  219. // /sc-community-web/parkingCar/queryRechargeRules
  220. this.$http
  221. .get('/sc-community-web/parkingCar/queryRechargeRules', { carType: this.cardType, parkingId: this.parkId })
  222. .then(({ data, msg, status }) => {
  223. console.log('data', data);
  224. this.rechargeDate = data;
  225. for (let i = 0; i < data.length; i++) {
  226. this.recharge.push({
  227. name: data[i].ruleName,
  228. label: data[i].ruleId,
  229. nameId: i
  230. })
  231. }
  232. })
  233. .catch(() => { });
  234. },
  235. recharges (item) {
  236. debugger
  237. this.id = item.id;
  238. this.valueselect = this.complimentaryDays[0].label;
  239. this.valueselectName = this.complimentaryDays[0].name;
  240. this.idType = this.complimentaryDays[0].idType;
  241. this.chargeAmount = this.complimentaryDays[0].chargeAmount;
  242. this.chargeNumber = item.name;
  243. },
  244. submit () {
  245. this.$http.post('/sc-community-web/parkingCar/carCharge', {
  246. amount: this.chargeAmount,
  247. carType: this.cardType,
  248. cardId: this.cardId,
  249. chargeMethod: this.idType,
  250. chargeNumber: this.chargeNumber,
  251. freeNumber: this.valueselectName,
  252. // orderNo: '',
  253. parkId: this.parkId,
  254. payChannel: this.paymentMethod,
  255. remark: this.inputText,
  256. validFrom: this.timeValue1,
  257. validTo: this.timeValue2
  258. }).then(({ data, status, msg }) => {
  259. })
  260. this.$emit('close');
  261. },
  262. },
  263. created () {
  264. console.log('11111')
  265. this.params;
  266. this.userName = this.params.userName;
  267. this.cardType = this.params.cardType;
  268. this.parkId = this.params.parkId;
  269. this.cardId = this.params.cardId;
  270. this.rechargeRules();
  271. }
  272. }
  273. </script>
  274. <style scoped>
  275. h3 {
  276. margin-bottom: 15px;
  277. }
  278. .el-col {
  279. margin-top: 10px !important;
  280. line-height: 30px;
  281. }
  282. .el-select {
  283. width: 90%;
  284. }
  285. .el-col > span {
  286. font-size: 12px;
  287. font-weight: 400;
  288. color: #ff7171;
  289. line-height: 17px;
  290. display: flex;
  291. justify-content: center;
  292. }
  293. </style>