UNPKG

captain-ui

Version:

有赞vue wap业务组件库

134 lines (129 loc) 3.29 kB
import "vant/es/toast/style"; import _Toast from "vant/es/toast"; import "vant/es/button/style"; import _Button from "vant/es/button"; import "vant/es/popup/style"; import _Popup from "vant/es/popup"; import "vant/es/icon/style"; import _Icon from "vant/es/icon"; import ajax from '../../common/ajax.js'; export default { render: function render() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; return _c('van-popup', { staticClass: "cap-mobile-auth-container", attrs: { "value": _vm.value } }, [_c('span', { staticClass: "cap-mobile-auth-container__close", on: { "click": _vm.onCloseClicked } }, [_vm._v("\n ×\n ")]), _c('h3', [_vm._v("手机号授权")]), _c('img', { staticClass: "logo", attrs: { "src": _vm.imgShopUrl, "width": "36", "height": "36" } }), _c('p', { staticClass: "name" }, [_vm._v(_vm._s(_vm.nameShop))]), _c('div', { staticClass: "cap-mobile-auth-container__hr" }), _vm.nameApp ? _c('p', { staticClass: "desc" }, [_vm._v("\n 申请获取你在" + _vm._s(_vm.nameApp) + "绑定的手机号\n ")]) : _c('p', { staticClass: "desc" }, [_vm._v("\n 申请获取你的手机号\n ")]), _c('p', { staticClass: "mobile" }, [_vm._v(_vm._s(_vm.phone.slice(0, 3) + '****' + _vm.phone.slice(7, _vm.phone.length)))]), _c('van-button', { attrs: { "size": "large", "type": "primary" }, on: { "click": _vm.next } }, [_vm._v("\n 确认授权\n ")]), _c('p', { staticClass: "extra" }, [_vm._v("授权即代表同意"), _c('a', { attrs: { "href": "https://bbs.youzan.com/forum.php?mod=viewthread&tid=672890&page=1&extra=#pid3837866" } }, [_vm._v("《有赞用户使用协议》")])])], 1); }, name: 'cap-mobile-auth', components: { 'van-icon': _Icon, 'van-popup': _Popup, 'van-button': _Button }, props: { value: { type: Boolean, default: false }, phone: { type: String, default: '' }, imgShopUrl: { type: String, default: '' }, nameShop: { type: String, default: '' }, nameApp: { type: String, default: '' }, kdtId: { type: Number, defalut: 0 }, onSuccess: { type: Function, default: null } }, data: function data() { return { name: 'World' }; }, methods: { onCloseClicked: function onCloseClicked() { this.$emit('input', false); }, next: function next() { var _this = this; var requestData = { mobile: this.phone, kdtId: this.kdtId }; ajax({ method: 'POST', data: requestData, url: 'https://passport.youzan.com/mobile-authentication/mobile-auth.json', rawResponse: true, withCredentials: true }).then(function (res) { if (res.code === 0) { if (_this.onSuccess) { _this.onSuccess(); } _this.onCloseClicked(); } else { _Toast(res.msg); } }).catch(function (err) { console.log(err); }); } } };