123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import '../css/bootstrap.less';
- import 'bootstrap/dist/js/bootstrap.js';
- import '../css/public.css';
- import '../css/member.css';
- import './public.js';
- import {
- message
- } from './tools.js';
- function loadBenefit(callback) {
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/open/html/json/member_benefit",
- success: function (data) {
- callback(data)
- },
- });
- }
- function loadData(pageNo) {
- var rank, money, mouth, gradeName;
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/api/portal/member/selectMemberGradeFr",
- success: function (data) {
- var theArr = [];
- if (data.data && data.data.length) {
- //黄金会员
- let thisdata1 = data.data[0],
- thisdata2 = data.data[1];
- let theBusiness1 = [],
- theBusiness2 = [];
- let theCost1 = [],
- theCost2 = [];
- loadBenefit((x) => {
- let BenefitObj = x;
- for (let item in thisdata1.business) {
- if (thisdata1.business[item] == "1") {
- theBusiness1.push('<p>' + BenefitObj[item] + '</p>')
- }
- };
- for (let item in thisdata2.business) {
- if (thisdata2.business[item] == "1") {
- theBusiness2.push('<p>' + BenefitObj[item] + '</p>')
- }
- };
- $('#member1business').append(theBusiness1.join(''));
- $('#member2business').append(theBusiness2.join(''));
- });
- for (let item in thisdata1.cost) {
- theCost1.push('<li data-mouth="' + item + '" data-money="' + thisdata1.cost[item] + '" data-rank="' + thisdata1.memberRank + '" data-gradename="' + thisdata1.gradeName + '">' + thisdata1.cost[item] + '/' + item + '个月</li>')
- };
- for (let item in thisdata2.cost) {
- theCost2.push('<li data-mouth="' + item + '" data-money="' + thisdata2.cost[item] + '" data-rank="' + thisdata2.memberRank + '" data-gradename="' + thisdata2.gradeName + '">' + thisdata2.cost[item] + '/' + item + '个月</li>')
- };
- $('#member1cost').append(theCost1.join(''));
- $('#member2cost').append(theCost2.join(''));
- } else {
- message(data.error[0].message);
- };
- $('.member_on ul').on('click', 'li', function (e) {
- e.preventDefault();
- if (userData && userData.mobile) {
- if (userData.lvl > 0) {
- mouth = this.dataset.mouth;
- money = this.dataset.money;
- rank = this.dataset.rank;
- gradeName = this.dataset.gradename;
- $('#modal-content').append("确认提交 " + money + " 元/ " + mouth + " 月的 " + gradeName + " 订单吗?");
- $('#myModal').modal('show');
- } else {
- message('请先进行实名认证,通过以后才能申请高级会员!');
- setTimeout("window.location.href = globalConfig.context + '/user/account/index.html#normal'", 3000);
- return;
- }
- } else {
- $('.login').fadeIn(800)
- }
- });
- $('#submitOrder').on('click', function (e) {
- $('#submitOrder').attr("disabled", true);
- $.ajax({
- method: "post",
- dataType: "json",
- url: globalConfig.context + "/api/user/member/addBasicsMemberOrder",
- data: {
- menberType: rank,
- price: money,
- validMonth: mouth
- },
- success: function (data) {
- if (data.error && data.error.length) {
- message(data.error[0].message);
- } else {
- message('提交会员服务订单成功!');
- setTimeout("window.location.href = globalConfig.context + '/user/account/index.html#serviceList'", 3000);
- }
- },
- });
- })
- },
- });
- }
- $(function () {
- loadData();
- })
|