1 /**
  2  * 单账号-更换手机
  3  * @type {Object}
  4  */
  5 define("change_account_phone", [
  6 	"component/process_ui", 
  7 	"business/bind_mobile", 
  8 	"business/set_login_name_confirm", 
  9 	"business/set_login_name", 
 10 	"business/phone_change_success"
 11 	], function() {
 12 	$we.process.config.change_account_phone = {
 13 		processes: [{
 14 			name: '原手机验证',
 15 			widget: "bind_mobile",
 16 			params: {
 17 				tips: ""
 18 			},
 19 			beforeAction: function() {
 20 				var phone = $we.process.getData("phone");
 21 				if(phone && phone.length > 0) {
 22 					var data = $we.process.getData("check_change_mobile");
 23 					if(data && data.errno) {
 24 						$we.comp.alert(data.msg);
 25 						this.notify("abort");
 26 						return false;
 27 					} else {
 28 						// $we.process.setData('old_is_mobile_acc',data['old_is_mobile_acc']);
 29 						return true;
 30 					}
 31 				} else {
 32 					$we.comp.alert('参数不全!');
 33 					this.notify("abort");
 34 					return false;
 35 				}
 36 			}
 37 		}, {
 38 			name: '新手机验证',
 39 			widget: "bind_mobile",
 40 			params: {
 41 				verifyName: 'new_phone',
 42 				//saveVerifyName: 'phone',
 43 				cookieName: '_we_comp_vm_n'
 44 			}
 45 		}, {
 46 			widget: "set_login_name_confirm",
 47 			params: {
 48 				group: false
 49 			},
 50 			beforeAction: function() {
 51 				var phone = $we.process.getData('phone');
 52 				var newPhone = $we.process.getData('new_phone');
 53 				var alias = $we.process.getData('alias');
 54 				var tips = "";
 55 				if(alias) {
 56 					tips = "<span class='we_yellow'>" + newPhone + "</span>已经是手机账号,更换后不能用手机号码<span class='we_yellow'>" + newPhone + "</span>直接登录,只能用" + alias + "登录";
 57 				} else {
 58 					tips = "<span class='we_yellow'>" + newPhone + "</span>已经是手机账号,需要设置新的登录名作为账号名登录";
 59 				}
 60 				this.params.tips = tips;
 61 				return $we.process.getData('need_demote');
 62 			}
 63 		}, {
 64 			widget: "set_login_name",
 65 			beforeAction: function() {
 66 				var phone = $we.process.getData('phone');
 67 				var newPhone = $we.process.getData('new_phone');
 68 				var tips = "<span class='we_yellow'>" + newPhone + "</span>已经是手机账号,需要设置新的登录名作为账号名登录";
 69 				this.params.tips = tips;
 70 				var alias = $we.process.getData('alias');
 71 				var needDemote = $we.process.getData('need_demote');
 72 				return needDemote && !(alias && alias.length > 0);
 73 			}
 74 		}, {
 75 			name: '更换成功',
 76 			widget: "phone_change_success"
 77 		}],
 78 		config: {
 79 			independent: false,
 80 			flow: "changeAccountMobile",
 81 			title: "更换手机",
 82 			prev: false
 83 		},
 84 		data: ["phone", "check_change_mobile"]
 85 	};
 86 
 87 	return $we.process.use;
 88 });