apply.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <!-- 申请分销商 -->
  2. <template>
  3. <view>
  4. <view style="color: #000000;">
  5. <tn-nav-bar backgroundColor="#ffffff" :bottomShadow="false">合伙人入驻</tn-nav-bar>
  6. <view :style="{height: tobheight+'px'}"></view>
  7. </view>
  8. <view class="u-content">
  9. <u-parse :content="intro"></u-parse>
  10. </view>
  11. <!-- <button class="u-reset-button save-btn" @tap="onSubmit" :disabled="isFormEnd">立即入驻</button> -->
  12. <view class="dygbhg">
  13. <view class="whole" @click="deleteall">退出</view>
  14. <view @click="showsettlein = true" class="distinguish">立即入驻{{commission_price>0?'(¥'+commission_price+')':''}}</view>
  15. </view>
  16. <u-popup :show="showsettlein" mode="bottom" :round="10" closeable @close="showsettlein = false">
  17. <view class="container">
  18. <view class="textl_ogin">填写资料</view>
  19. <!-- 填写资料 -->
  20. <view class="login">
  21. <view class="input u-flex align-center">
  22. <u-icon name="account-fill" color="#5336ff" size="24"></u-icon>
  23. <input class="vs-flex-item" v-model="form.name" :maxlength="11" placeholder="请输入姓名" />
  24. </view>
  25. <view class="input u-flex align-center">
  26. <u-icon name="phone-fill" color="#5336ff" size="24"></u-icon>
  27. <input
  28. class="vs-flex-item"
  29. type="number"
  30. v-model="form.number"
  31. placeholder="请输入手机号"
  32. placeholder-class="input-placeholder"
  33. />
  34. <!-- <u-icon @click="password = !password" :name="password ? 'eye-off' : 'eye-fill'" color="#26B3A0" size="18"></u-icon> -->
  35. </view>
  36. </view>
  37. <view @click="onSubmit()" hover-class="hoversubmit" class="signinnow">确认提交</view>
  38. </view>
  39. </u-popup>
  40. </view>
  41. </template>
  42. <script>
  43. import { mapMutations, mapActions, mapState, mapGetters } from 'vuex';
  44. import ShoproPay from '@/common/pay';
  45. export default {
  46. data() {
  47. return {
  48. tobheight:45,
  49. platform: this.$platform.get(),
  50. intro:'',
  51. showsettlein:false,
  52. form:{
  53. name:'',
  54. number:''
  55. },
  56. commission_price:0,
  57. paid:0
  58. };
  59. },
  60. computed: {
  61. ...mapGetters(['appInfo', 'userInfo', 'isLogin'])
  62. },
  63. onLoad() {
  64. const that = this;
  65. if(this.platform == 'wxMiniProgram'){
  66. var menumtop = uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight
  67. var paddingtop = uni.getSystemInfoSync().statusBarHeight + menumtop
  68. this.tobheight = (menumtop+paddingtop+uni.getMenuButtonBoundingClientRect().height)
  69. }
  70. this.auth()
  71. this.commission()
  72. },
  73. methods: {
  74. deleteall(){
  75. uni.navigateBack()
  76. },
  77. commission(){
  78. let that = this;
  79. that.$http('conf.getGroupConf',{group:'system.commission'}).then(res => {
  80. if (res.code === 0) {
  81. this.intro = res.data.intro
  82. this.commission_price = res.data.commission_price
  83. uni.setNavigationBarTitle({
  84. title: that.appInfo.site_name
  85. });
  86. }
  87. });
  88. },
  89. auth(){
  90. let that = this;
  91. that.$http('commission.auth').then(res => {
  92. if(res.code == 0){
  93. that.paid = res.data.paid
  94. }
  95. })
  96. },
  97. create(){
  98. let that = this;
  99. that.$http('order.createSettle', {
  100. pay_type: 'wechat',
  101. real_name:that.form.name,
  102. telnum:that.form.number
  103. }).then(res => {
  104. if (res.code === 0) {
  105. // let pay = new ShoproPay('wechat', res.data,1);
  106. if(that.userInfo.openid_miniapp || that.userInfo.openid_wechat){
  107. let pay = new ShoproPay('wechat', res.data,1);
  108. }else{
  109. // console.log(res.data);
  110. that.paytest(res.data.order_number,res.data.id)
  111. }
  112. } else {
  113. that.$u.toast(res.msg);
  114. }
  115. });
  116. },
  117. paytest(e,id){
  118. uni.showLoading({
  119. title:'支付跳转中...'
  120. })
  121. let uniacid = uni.getStorageSync("uniacid") || "";
  122. this.$http('pay.hupijiaopay', {
  123. order_number:e,
  124. is_commission:1,
  125. return_url:window.location.href.split('/h5')[0]+'/h5/pages/user/public/paymentdetail?uniacid='+uniacid+'&orderType=1&orderId='+id,
  126. callback_url:window.location.href,
  127. }).then(res => {
  128. // console.log(res);
  129. if (res.code === 0) {
  130. // console.log(res.data);
  131. window.location.href = res.data.url
  132. // uni.navigateTo({
  133. // url:'pages/user/public/webview?url='+res.data.url
  134. // })
  135. } else {
  136. this.$u.toast(res.msg);
  137. }
  138. });
  139. },
  140. commissionapply(){
  141. var that = this;
  142. that.$http('commission.apply',{real_name:that.form.name,telnum:that.form.number}).then(res => {
  143. if(res.code == 0){
  144. uni.showToast({
  145. title:'申请成功'
  146. })
  147. setTimeout(function() {
  148. uni.redirectTo({
  149. url:'/pages/user/commission/index'
  150. })
  151. }, 1500);
  152. }else{
  153. uni.showModal({
  154. confirmText:'重新申请',
  155. confirmColor:'#5e49c3',
  156. content:'合伙人申请失败',
  157. title:'提示',
  158. success(res) {
  159. if(res.confirm){
  160. this.create()
  161. }else if(res.cancel){
  162. // uni.navigateBack()
  163. }
  164. }
  165. })
  166. }
  167. });
  168. },
  169. // 提交
  170. onSubmit() {
  171. let that = this;
  172. // console.log(this.form);
  173. if(!that.form.name){
  174. uni.showToast({
  175. title:'请输入您的姓名',
  176. icon:'none'
  177. })
  178. }else if(!uni.$u.test.chinese(that.form.name)){
  179. uni.showToast({
  180. title:'请输入姓名为汉字',
  181. icon:'none'
  182. })
  183. }else if(!uni.$u.test.rangeLength(that.form.name, [2, 10])){
  184. uni.showToast({
  185. title:'姓名长度不能低于2位多于10位',
  186. icon:'none'
  187. })
  188. }else if(!that.form.number){
  189. uni.showToast({
  190. title:'请输入手机号',
  191. icon:'none'
  192. })
  193. }else if(!uni.$u.test.mobile(that.form.number)){
  194. uni.showToast({
  195. title:'请输入正确的手机号',
  196. icon:'none'
  197. })
  198. }else{
  199. if(that.commission_price>0){
  200. that.create()
  201. return;
  202. }else{
  203. that.commissionapply()
  204. return;
  205. }
  206. }
  207. }
  208. }
  209. };
  210. </script>
  211. <style lang="scss">
  212. .u-content {
  213. padding: 30rpx;
  214. font-size: 32rpx;
  215. color: $u-content-color;
  216. line-height: 1.6;
  217. }
  218. .dygbhg {
  219. background: #ffffff;
  220. border-radius: 20rpx 20rpx 0 0;
  221. position: fixed;
  222. bottom: 0;
  223. width: 100%;
  224. box-shadow: 0px 0px 10px #00000024;
  225. display: flex;
  226. align-items: center;
  227. justify-content: space-evenly;
  228. }
  229. .whole{
  230. width: 30%;
  231. height: 100rpx;
  232. display: flex;
  233. color: #ffffff;
  234. align-items: center;
  235. justify-content: center;
  236. background: #9E9E9E;
  237. // font-weight: bold;
  238. border-radius: 60rpx;
  239. }
  240. .distinguish {
  241. width: 56%;
  242. height: 100rpx;
  243. display: flex;
  244. color: #ffffff;
  245. align-items: center;
  246. justify-content: center;
  247. background: linear-gradient(-90deg, #a36fff, #5336ff);
  248. font-weight: bold;
  249. border-radius: 60rpx;
  250. margin: 38rpx 0;
  251. margin-left: 4%;
  252. }
  253. .container {
  254. margin-top: 60rpx;
  255. .bg {
  256. display: flex;
  257. align-items: center;
  258. justify-content: center;
  259. position: relative;
  260. height: 400rpx;
  261. margin-bottom: 80rpx;
  262. }
  263. .topimg {
  264. image {
  265. width: 180rpx;
  266. height: 180rpx;
  267. border-radius: 50%;
  268. }
  269. }
  270. .textl_ogin {
  271. font-size: 40rpx;
  272. margin: 0 60rpx 50rpx;
  273. font-weight: bold;
  274. }
  275. .login{
  276. margin-bottom: 80rpx;
  277. }
  278. .signinnow{
  279. background: linear-gradient(-90deg, #a36fff, #5336ff);
  280. font-size: 34rpx;
  281. color: #fff;
  282. margin: 0 60rpx 40rpx;
  283. text-align: center;
  284. line-height: 90rpx;
  285. height: 90rpx;
  286. border-radius: 60rpx;
  287. font-weight: bold;
  288. }
  289. .input {
  290. // width: 630rpx;
  291. height: 100rpx;
  292. padding: 0 30rpx;
  293. background: #f7f7f7;
  294. border-radius: 60rpx;
  295. flex-direction: row;
  296. // margin-left: 60rpx;
  297. // margin-bottom: 40rpx;
  298. margin: 0 60rpx 40rpx;
  299. font-style: normal;
  300. font-size: 30rpx;
  301. font-family: Droid Sans Fallback;
  302. &-icon {
  303. width: 30rpx;
  304. height: 38rpx;
  305. }
  306. }
  307. .hoversubmit{
  308. background: #F7F7F7;
  309. color: #ACACB3;
  310. }
  311. .vs-flex-item {
  312. flex: 1;
  313. margin-left: 16rpx;
  314. }
  315. }
  316. </style>