checkoutCode.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <div class="orderManage app-container">
  3. <div class="search">
  4. <div>
  5. <el-input v-model="query.id" size="small" placeholder="请输入完整激活ID" class="item-width-200"></el-input>
  6. <el-input v-model="query.serialNumber" size="small" placeholder="请输入激活码" class="item-width-200 ml10"></el-input>
  7. <el-input v-model="query.phone" size="small" placeholder="请输入激活手机号" class="item-width-200 ml10"></el-input>
  8. <el-date-picker v-model="date" size="small" value-format="yyyy-MM-dd" class="item-width-350 ml10"
  9. type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  10. </el-date-picker>
  11. <el-select v-model="query.state" size="small" clearable class="item-width-200 ml10" placeholder="请选择状态">
  12. <el-option label="待使用" value="1"></el-option>
  13. <el-option label="激活成功" value="2"></el-option>
  14. </el-select>
  15. <el-button class="ml10" type="primary" size="small" icon="el-icon-search" @click="handleSearch">
  16. 搜索
  17. </el-button>
  18. </div>
  19. <el-button class="ml10" type="info" size="small" plain icon="el-icon-back" @click="comeBack">
  20. 返回
  21. </el-button>
  22. </div>
  23. <el-descriptions class="margin-top" :column="3" border>
  24. <el-descriptions-item>
  25. <template slot="label"> 计费号 </template>
  26. {{ groupInfos.billId||'--' }}
  27. </el-descriptions-item>
  28. <el-descriptions-item>
  29. <template slot="label"> 集团名称 </template>
  30. {{ groupInfos.groupName||'--' }}
  31. </el-descriptions-item>
  32. <el-descriptions-item>
  33. <template slot="label"> 订购数量 </template>
  34. {{ groupInfos.orderNum||'--' }}
  35. </el-descriptions-item>
  36. <el-descriptions-item>
  37. <template slot="label"> 所属平台 </template>
  38. 慧研学惠生活
  39. </el-descriptions-item>
  40. <el-descriptions-item>
  41. <template slot="label"> 订购产品策划名称 </template>
  42. {{ groupInfos.groupPlanName||'--' }}
  43. </el-descriptions-item>
  44. <el-descriptions-item>
  45. <template slot="label"> 激活码数量 </template>
  46. {{ groupInfos.totalTicket||'--' }}
  47. </el-descriptions-item>
  48. <el-descriptions-item>
  49. <template slot="label"> 已使用数量 </template>
  50. {{ groupInfos.useTicket||'--' }}
  51. </el-descriptions-item>
  52. <el-descriptions-item>
  53. <template slot="label"> 未使用数量 </template>
  54. {{ groupInfos.totalTicket-groupInfos.useTicket||'--' }}
  55. </el-descriptions-item>
  56. <el-descriptions-item>
  57. <template slot="label"> 激活失败 </template>
  58. {{ '--' }}
  59. </el-descriptions-item>
  60. </el-descriptions>
  61. <div style="height: 20px;"></div>
  62. <el-table :data="tableData" tooltip-effect="dark" border v-loading="loading" style="width: 100%">
  63. <el-table-column align="center" label="激活ID" prop="id" show-overflow-tooltip>
  64. </el-table-column>
  65. <el-table-column prop="serialNumber" align="center" label="激活码" show-overflow-tooltip>
  66. </el-table-column>
  67. <el-table-column prop="planningName" align="center" label="会员套餐" show-overflow-tooltip>
  68. </el-table-column>
  69. <el-table-column prop="goodsAmount" align="center" label="有效期类型" show-overflow-tooltip>
  70. <template slot-scope="scope">
  71. <span v-if="scope.row.activationType == 1">时间段</span>
  72. <span v-else>天数</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column prop="activationDay" align="center" label="时间段/天数" show-overflow-tooltip>
  76. <template slot-scope="scope">
  77. <span v-if="scope.row.activationType == 1">{{ timeFormat(scope.row.startTime) }}至{{ timeFormat(scope.row.endTime) }}</span>
  78. <span v-else>
  79. {{ scope.row.activationDay}}
  80. </span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column prop="startTime" align="center" label="创建时间" show-overflow-tooltip>
  84. <template slot-scope="scope">
  85. {{ timeFormat(scope.row.createTime) }}
  86. </template>
  87. </el-table-column>
  88. <el-table-column align="center" label="状态" show-overflow-tooltip>
  89. <template slot-scope="scope">
  90. <span v-if="scope.row.phone == null">待使用</span>
  91. <span v-else>激活成功</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column align="center" label="推送状态" show-overflow-tooltipphone>
  95. <template slot-scope="scope">
  96. <span>{{scope.row.sync===true?'推送成功':'--'}}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column align="center" label="激活手机号" show-overflow-tooltip>
  100. <template slot-scope="scope">
  101. {{ scope.row.phone|| '--' }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column align="center" label="激活时间" show-overflow-tooltip>
  105. <template slot-scope="scope">
  106. <span v-if="scope.row.phone==null">--</span>
  107. <span v-else>{{ timeFormat(scope.row.useTime) }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column prop="address" align="center" label="操作">
  111. <template slot-scope="scope">
  112. <el-button type="text" size="small" v-if="scope.row.phone == null"
  113. @click="activationVip(scope.row)">激活</el-button>
  114. <el-button type="text" size="small" v-else @click="synchronization(scope.row)">同步</el-button>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. <div class="page-box">
  119. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" background
  120. :current-page="query.page" :page-sizes="[10, 20, 30, 40]" :page-size="query.size"
  121. layout="total, sizes, prev, pager, next, jumper" :total="total">
  122. </el-pagination>
  123. </div>
  124. <el-dialog title="激活" :visible.sync="vipDialogVisible" width="30%" center>
  125. <div style="margin-left: 32px;margin-bottom: 30px;font-weight: 600;">激活码:{{ vipCode }}</div>
  126. <el-form :model="updataPhone" ref="updataPhone" :rules="rules" label-width="130px" size="small">
  127. <el-form-item label="激活手机号:" prop="num">
  128. <el-input v-model="updataPhone.num" class="item-width-200" placeholder="请输入激活手机号"></el-input>
  129. </el-form-item>
  130. </el-form>
  131. <span slot="footer" class="dialog-footer">
  132. <el-button @click="Cancel">取 消</el-button>
  133. <el-button type="primary" :loading="updataLoading" @click="confirmActivation('updataPhone')">确 定</el-button>
  134. </span>
  135. </el-dialog>
  136. </div>
  137. </template>
  138. <script>
  139. import { debounce } from "@/utils/index";
  140. import { checkoutActivationCode, labourActivation,syncNotified } from "@/api/common";
  141. import { timeFormat } from "@/utils/index";
  142. export default {
  143. name: "orderManage",
  144. data() {
  145. return {
  146. updataLoading: false,
  147. date: '',
  148. vipCode: '',
  149. groupInfos: {},
  150. updataPhone: {
  151. num: '',
  152. },
  153. rules: {
  154. num: [
  155. { required: true, pattern: /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/, message: "请正确输入手机号", trigger: "blur" },
  156. ],
  157. },
  158. vipDialogVisible: false,
  159. tableData: [],
  160. loading: false,
  161. query: {
  162. id: '',
  163. phone: "",
  164. serialNumber: "",
  165. groupOrderNo: '',
  166. startTime: "",
  167. endTime: "",
  168. state:'',
  169. page: 1,
  170. size: 10,
  171. },
  172. title: "",
  173. total: 0,
  174. };
  175. },
  176. watch: {
  177. date(val) {
  178. if (val) {
  179. this.query.startTime = Date.parse(val[0]);
  180. this.query.endTime = Date.parse(val[1]);
  181. } else {
  182. this.query.startTime = "";
  183. this.query.endTime = "";
  184. }
  185. },
  186. },
  187. filters: {
  188. },
  189. methods: {
  190. // 同步和校园数据,待完成
  191. synchronization(item){
  192. syncNotified({ticketId:item.id}).then((res)=>{
  193. if(res.state == "Success"){
  194. this.getList()
  195. }
  196. })
  197. },
  198. Cancel(){
  199. this.vipDialogVisible = false;
  200. this.updataPhone.num = ''
  201. },
  202. // 确认激活
  203. confirmActivation(formName) {
  204. this.$refs[formName].validate((valid) => {
  205. let updata = {
  206. phone:this.updataPhone.num,
  207. serialNumber: this.vipCode
  208. }
  209. if (valid) {
  210. this.updataLoading = true;
  211. labourActivation({ ...updata }).then((res) => {
  212. this.updataLoading = false
  213. if (res.state == "Success") {
  214. this.vipDialogVisible = false
  215. this.updataPhone.num = ''
  216. this.getList()
  217. } else {
  218. }
  219. })
  220. } else {
  221. return false;
  222. }
  223. });
  224. },
  225. // 激活弹窗
  226. activationVip(item) {
  227. this.vipDialogVisible = true
  228. this.vipCode = item.serialNumber
  229. },
  230. // 返回上一级
  231. comeBack() {
  232. this.$router.back()
  233. },
  234. handleSearch() {
  235. this.query.page = 1;
  236. this.getList();
  237. },
  238. timeFormat(val) {
  239. return timeFormat(val);
  240. },
  241. handleSizeChange(val) {
  242. this.query.page = 1;
  243. this.query.size = val;
  244. this.getList();
  245. },
  246. handleCurrentChange(val) {
  247. this.query.page = val;
  248. this.getList();
  249. },
  250. search() {
  251. this.query.page = 1;
  252. this.getList();
  253. },
  254. getList() {
  255. this.loading = true;
  256. this.groupInfos = JSON.parse(this.$route.query.groupInfo)
  257. this.query.groupOrderNo = this.groupInfos.orderNo;
  258. let obj = JSON.parse(JSON.stringify(this.query));
  259. obj.page = obj.page - 1;
  260. if (!obj.orderType) {
  261. delete obj.orderType;
  262. }
  263. checkoutActivationCode(obj).then((res) => {
  264. this.loading = false;
  265. if (res.state == "Success") {
  266. this.tableData = res.content.content;
  267. this.total = res.content.totalElements;
  268. }
  269. });
  270. },
  271. },
  272. created() {
  273. this.getList();
  274. },
  275. };
  276. </script>
  277. <style lang="scss"></style>