apply.vue 7.8 KB

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