addoperator.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="container operator clearfix">
  3. <view class="operator-content">
  4. <view class="operator-from">
  5. <view class="from-row">
  6. <input class="input" type="text" v-model="linkman" placeholder="请输入运营人员姓名" maxlength="6"/>
  7. </view>
  8. <view class="from-row">
  9. <input class="input" type="text" v-model="clubMobile" placeholder="请输入运营人员手机号" maxlength="11"/>
  10. </view>
  11. <button class="add-btn" @click="confirm">{{buttonText}}</button>
  12. </view>
  13. <view class="operator-text">
  14. <view class="title" @click="this.$api.navigateTo('/pages/user/operator/bindstep')">
  15. <text class="iconfont icon-gantanhao-yuankuang"></text>
  16. <text class="text-m">运营人员绑定步骤</text>
  17. <text class="text-s">(点击查看图片引导)</text>
  18. </view>
  19. <view class="text-main">
  20. <view>1. 添加运营人员后,运营人员会收到一条邀请码短信</view>
  21. <view>2.运营人员在微信搜索“采美采购商城”小程序,在登录页使用邀请码授权绑定微信或关注“采美365网”公众号,在聊天框中输入“绑定运营人员”并发送,点击自动回复的链接,然后输入邀请码绑定微信</view>
  22. <view>3. 绑定微信后,运营人员可通过微信授权直接登录采美365网</view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import authorize from '@/common/config/authorize.js'
  30. export default {
  31. data() {
  32. return {
  33. buttonText:'确定',
  34. addType:1, //记录添加地址的类型
  35. linkman:'',
  36. clubMobile:'',
  37. isConfirm:true,
  38. isShowInput:false,
  39. switchDefault:false,
  40. params:{} //参数
  41. }
  42. },
  43. onLoad(option){
  44. // console.log(option.data)
  45. let title = '添加新地址'
  46. if(option.type==='edit'){
  47. title = '编辑收货地址'
  48. this.isConfirm = false;
  49. this.addType = 2;
  50. this.addressData = JSON.parse(option.data)
  51. this.addressData.address = `${this.addressData.province}-${this.addressData.city}-${this.addressData.town}`
  52. this.addressData.userOrganizeID = this.userOrganizeID;
  53. this.addressData.defaultFlag = this.addressData.defaultFlag;
  54. if(this.addressData.defaultFlag == 1){
  55. this.switchDefault = true
  56. }else{
  57. this.switchDefault = false
  58. }
  59. }
  60. uni.setNavigationBarTitle({
  61. title
  62. })
  63. },
  64. methods: {
  65. //提交
  66. confirm(){
  67. let data = this.addressData;
  68. if(this.linkman== ''){
  69. this.$util.msg('请输入运营人员姓名');
  70. return;
  71. }
  72. if(this.clubMobile == ''){
  73. this.$util.msg('请输入运营人员手机号');
  74. return;
  75. }
  76. if(!/(^1[0-9][0-9]{9}$)/.test(this.clubMobile)){
  77. this.$util.msg('请输入正确的手机号码');
  78. return;
  79. }
  80. if(this.addType ==1){
  81. this.params ={
  82. userID:data.userID ,//用户id ,只在新增收货地址时传
  83. shouHuoRen:data.shouHuoRen ,//收货人
  84. townID:data.townID,//区ID
  85. addressDetail:data.addressDetail,//地址
  86. mobile:data.mobile,//手机
  87. userOrganizeID:this.userOrganizeID,//组织ID
  88. defaultFlag:data.defaultFlag//是否默认收货地址(0 不是默认,1 默认)
  89. }
  90. this.postAddressData(this.params)
  91. }else{
  92. this.params = this.addressData;
  93. this.postAddressData(this.params)
  94. }
  95. },
  96. postAddressData(res){
  97. let self = this;
  98. self.btnText(true)
  99. authorize.getCode('weixin').then(wechatcode =>{
  100. self.$api.post('/personal/save?code='+`${wechatcode}`,JSON.stringify(res),
  101. response => {
  102. if(response.code==1){
  103. self.$util.msg(response.msg,3000);
  104. self.btnText(false)
  105. uni.navigateBack();
  106. }else{
  107. self.$util.msg(response.msg,3000);
  108. setTimeout(function(){
  109. uni.switchTab({
  110. url:'/pages/tabBar/home/home'
  111. })
  112. },1000)
  113. }
  114. }
  115. )
  116. })
  117. },
  118. btnText(flg){
  119. if(flg){
  120. this.isConfirm = true;
  121. this.buttonText = '保存中...'
  122. }else{
  123. this.isConfirm = false;
  124. this.buttonText = '保存'
  125. }
  126. },
  127. onShouHuoRen(e){
  128. this.addressData.shouHuoRen = e.detail.value;
  129. // console.log(this.addressData.shouHuoRen)
  130. this.initInput();
  131. },
  132. onMobile(e){
  133. this.addressData.mobile = e.detail.value;
  134. // console.log(this.addressData.mobile)
  135. this.initInput();
  136. },
  137. onTextareaInput(e){
  138. this.addressData.addressDetail = e.detail.value;
  139. // console.log(this.addressData.addressDetail)
  140. this.initInput();
  141. },
  142. initInput(){
  143. if(this.addressData.shouHuoRen !== "" && this.addressData.mobile !=="" && this.addressData.addressDetail !==""){
  144. this.isConfirm =false;
  145. }else{
  146. this.isConfirm =true;
  147. }
  148. }
  149. },
  150. onShow() {
  151. this.$api.getStorage().then((resolve) =>{
  152. this.addressData.userID = resolve.userID
  153. })
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. page{
  159. height: auto;
  160. background: $bg-color;
  161. border-top: 1px solid #EBEBEB;
  162. }
  163. .operator{
  164. padding-top: 160rpx;
  165. .operator-content{
  166. width: 702rpx;
  167. padding:0 24rpx;
  168. .operator-from{
  169. width: 100%;
  170. height: auto;
  171. .from-row{
  172. width: 100%;
  173. height: 40rpx;
  174. padding: 24rpx;
  175. background: #F7F7F7;
  176. border-radius: 14rpx;
  177. margin-bottom: 20rpx;
  178. font-size: $font-size-28;
  179. color: $text-color;
  180. .input{
  181. width: 100%;
  182. height: 100%;
  183. text-align: left;
  184. }
  185. }
  186. }
  187. .operator-text{
  188. width: 100%;
  189. height: auto;
  190. margin-top: 50rpx;
  191. line-height: 40rpx;
  192. .title{
  193. margin-bottom: 50rpx;
  194. .icon-gantanhao-yuankuang{
  195. font-size: $font-size-32;
  196. color: #166CE1;
  197. margin-right: 10rpx;
  198. }
  199. .text-m{
  200. font-size: $font-size-30;
  201. color: #166CE1;
  202. }
  203. .text-s{
  204. font-size: $font-size-24;
  205. color: #999999;
  206. }
  207. }
  208. .text-main{
  209. width: 100%;
  210. height: auto;
  211. view{
  212. line-height: 40rpx;
  213. font-size: $font-size-28;
  214. color: $text-color;
  215. text-align: justify;
  216. margin-bottom: 10rpx;
  217. }
  218. }
  219. }
  220. }
  221. .add-btn{
  222. width: 702rpx;
  223. height: 88rpx;
  224. font-size: $font-size-28;
  225. line-height: 88rpx;
  226. color: #FFFFFF;
  227. margin: 0 auto;
  228. text-align: center;
  229. background: $btn-confirm;
  230. border-radius: 14rpx;
  231. margin-top: 80rpx;
  232. }
  233. .add-btn.disabled{
  234. background: #F8F8F8;
  235. border-radius: 14rpx;
  236. }
  237. }
  238. </style>