userMsgMenager.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view>
  3. <customNav :shownav="true" :title="$t('index.usermsg')" titledetl=""></customNav>
  4. <view class="yzmctV" style="margin-top: 26rpx;">
  5. <text style="font-size: 28rpx;color: darkgray;">{{$t('goods.xiugaishx')}}</text>
  6. </view>
  7. <view class="yzmctV">
  8. <yhdslCropper ref="yhdslCropper" :quality="1" mode="scale" @uploadImg="uploadImg" :scale="scale"></yhdslCropper>
  9. <netImage style="margin-top: 30rpx;" width="120" height="120" bradius="60" :mysrc="userIcon" mymode="scaleToFill"></netImage>
  10. </view>
  11. <view class="yzmlist">
  12. <text class="textfontS1 tittext">{{$t('user.nicheng')}}:</text>
  13. <input class="noinputV" type="text" :placeholder="$t('user.qingshuryhnc')" :value="nikename" @input="phoneinput">
  14. </view>
  15. <view class="yzmlist">
  16. <text class="textfontS1 tittext">{{$t('schema.name')}}:</text>
  17. <input class="noinputV" type="text" :placeholder="$t('index.qingshuru')" :value="fullName" @input="fullNameinput">
  18. </view>
  19. <view class="yzmlist">
  20. <text class="textfontS1 tittext">Email:</text>
  21. <input class="noinputV" type="text" :placeholder="$t('user.qingtianxndyx')" :value="email" @input="smsCodeinput">
  22. </view>
  23. <!-- <view class="yzmctV">
  24. <input class="noinputV" type="text" :placeholder="$t('user.qingtianxndyx')" :value="email" @input="smsCodeinput">
  25. </view> -->
  26. <view class="yzmctV bottomline" style="line-height: 60rpx;">
  27. <radio-group @change="radioChange">
  28. <radio value="0" :checked="sex==0" />
  29. {{$t('index.xiansheng')}}
  30. <radio value="1" :checked="sex==1"/>
  31. {{$t('index.nvshi')}}
  32. <radio value="2" :checked="sex==2"/>
  33. {{$t('index.weizhi')}}
  34. </radio-group>
  35. </view>
  36. <!-- <view class="yzmctV" style="margin-top: 20rpx;">
  37. <text class="textfontS1" style="width: 90%;">{{$t('user.shenfenzh')}}</text>
  38. </view>
  39. <view class="yzmctV">
  40. <input class="lginputV" type="text" :placeholder="$t('index.qingshuru')" :value="idNumber" @input="idNumberinput">
  41. </view> -->
  42. <view class="yzmctV" style="margin-top: 30rpx;">
  43. <text class="textfontS1" style="width: 90%;">{{$t('user.shenfentupian')}} A</text>
  44. </view>
  45. <view class="yzmctV" @click="passportImage(11)">
  46. <netImage width="610" height="610" bradius="4" :mysrc="passportPTA" mymode="scaleToFill"></netImage>
  47. </view>
  48. <view class="yzmctV">
  49. <text class="textfontS1" style="width: 90%;">{{$t('user.shenfentupian')}} B</text>
  50. </view>
  51. <view class="yzmctV" @click="passportImage(12)">
  52. <netImage width="610" height="610" bradius="4" :mysrc="passportPTB" mymode="scaleToFill"></netImage>
  53. </view>
  54. <!-- <view class="yzmctV" style="margin-top: 30rpx;">
  55. <text class="textfontS1">{{$t('user.yinhangxinx')}}:</text>
  56. </view>
  57. <view class="yzmctV">
  58. <input class="lginputV" type="text" :placeholder="$t('index.qingshuru')" :value="bankAccount" @input="bankinput">
  59. </view>
  60. <view class="yzmctV">
  61. <text class="textfontS1" style="width: 90%;">{{$t('user.yinghangtupian')}}</text>
  62. </view>
  63. <view class="yzmctV" @click="bankImage">
  64. <netImage width="610" height="610" bradius="4" :mysrc="bankPT" mymode="scaleToFill"></netImage>
  65. </view> -->
  66. <view class="yzmctV bottomline" style="line-height: 60rpx;">
  67. <radio-group @change="mcTypeChange">
  68. <radio value="0" :checked="merchantType==0" />
  69. {{$t('user.gerensj')}}
  70. <radio value="1" :checked="merchantType==1"/>
  71. {{$t('user.qiye')}}
  72. </radio-group>
  73. </view>
  74. <view class="yzmctV">
  75. <label class="querenBt" @click="updata">{{$t('index.tijiao')}}</label>
  76. </view>
  77. <view style="height: 40rpx;"></view>
  78. </view>
  79. </template>
  80. <script>
  81. import ApibaseUrl from "@/config/urlConfig.js"
  82. import api from "@/pages/api/api.js"
  83. import yhdslCropper from '@/components/yhdsl-cropper/yhdsl-cropper.vue';
  84. export default {
  85. components: {
  86. yhdslCropper
  87. },
  88. data() {
  89. return {
  90. token:'',
  91. nikename:'',
  92. email:'',
  93. sex:1,
  94. userIcon:'',
  95. userInfo:[],
  96. scale:1,
  97. merchantType:0,
  98. fullName:'',
  99. idNumber:'',
  100. passportPTA:'',
  101. passportPTB:'',
  102. bankPT:'',
  103. bankAccount:'',
  104. imgeState:0
  105. }
  106. },
  107. onLoad() {
  108. var temp = uni.getStorageSync("userInfo");
  109. this.userInfo = JSON.parse(temp);
  110. console.log('11',this.userInfo)
  111. this.nikename=this.userInfo.nickName;
  112. this.email = this.userInfo.email;
  113. this.sex = this.userInfo.sex;
  114. this.userIcon = this.userInfo.avatar;
  115. if(this.userInfo.passportPhoto){
  116. var pts = this.userInfo.passportPhoto.split(",");
  117. if(pts&&pts.length==2){
  118. this.passportPTA = pts[0];
  119. this.passportPTB = pts[1];
  120. }
  121. }
  122. this.bankPT = this.userInfo.bankPhoto;
  123. this.fullName=this.userInfo.fullName;
  124. this.idNumber=this.userInfo.idNumber;
  125. this.bankAccount=this.userInfo.bankAccount;
  126. this.merchantType=this.userInfo.merchantType;
  127. },
  128. methods: {
  129. radioChange(e){
  130. console.log(e.detail.value)
  131. this.sex=e.detail.value;
  132. },
  133. mcTypeChange(e){
  134. console.log(e.detail.value)
  135. this.merchantType=e.detail.value;
  136. },
  137. phoneinput(event){
  138. this.nikename = event.target.value;
  139. },
  140. fullNameinput(event){
  141. this.fullName = event.target.value;
  142. },
  143. smsCodeinput(event){
  144. this.email = event.target.value;
  145. },
  146. idNumberinput(event){
  147. this.idNumber = event.target.value;
  148. },
  149. bankinput(event){
  150. this.bankAccount = event.target.value;
  151. },
  152. imageUpdata(){
  153. this.imgeState=0;
  154. this.scale=1;
  155. this.$refs.yhdslCropper.chooseImage();
  156. },
  157. passportImage(index){
  158. this.imgeState=index;
  159. this.selectImage();
  160. },
  161. bankImage(){
  162. this.imgeState=2;
  163. this.selectImage();
  164. },
  165. selectImage(){
  166. var that = this;
  167. var ulUrl = ApibaseUrl.getUploadUrl();
  168. console.log(ulUrl)
  169. uni.chooseImage({
  170. count: 1, // 图片数量
  171. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  172. sourceType: ['album'], //从相册选择或者拍照
  173. success: (res) => {
  174. const tempFilePaths = res.tempFilePaths;
  175. uni.showLoading({
  176. mask:true
  177. })
  178. uni.uploadFile({
  179. url:ulUrl, //上传图片api
  180. filePath: tempFilePaths[0],
  181. name: 'file',
  182. header:{
  183. //"Authorization": userinfo.token
  184. },
  185. success: (res) => {
  186. uni.hideLoading();
  187. let group = JSON.parse(res.data);
  188. if(that.imgeState==11){
  189. that.passportPTA=group.data;
  190. }
  191. if(that.imgeState==12){
  192. that.passportPTB=group.data;
  193. }
  194. if(that.imgeState==2){
  195. that.bankPT=group.data;
  196. }
  197. },
  198. fail() {
  199. uni.hideLoading();
  200. }
  201. });
  202. }
  203. });
  204. },
  205. uploadImg(e) {
  206. var ulUrl = ApibaseUrl.getUploadUrl();
  207. console.log('------------uploadImg:',ulUrl)
  208. this.spImage = e;
  209. var that = this;
  210. uni.uploadFile({
  211. url: ulUrl, //上传图片api
  212. filePath: e,
  213. name: 'file',
  214. header:{
  215. //"Authorization": userinfo.token
  216. },
  217. success: (res) => {
  218. console.log(res)
  219. let group = JSON.parse(res.data);
  220. if(that.imgeState==0){
  221. that.userIcon=group.data;
  222. }
  223. uni.showToast({
  224. title:that.$t('mend.shangccg'),
  225. icon:"success"
  226. })
  227. },
  228. fail(err) {
  229. console.log(err)
  230. }
  231. });
  232. },
  233. updata(){
  234. var pattern = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$/;
  235. if (pattern.test(this.email)) {
  236.   ;
  237. } else {
  238.   console.log("错误的邮箱地址!");
  239. if(this.email==''||null==this.email||undefined==this.email){
  240. }
  241. else{
  242. uni.showToast({
  243. title:'Nhầm địa chỉ email!',
  244. icon:"none"
  245. })
  246. return;
  247. }
  248. }
  249. this.updataUserMsg();
  250. },
  251. updataUserMsg(){
  252. var passportPT=[this.passportPTA,this.passportPTB];
  253. api('updataUserMsg',{
  254. "nickName":this.nikename,
  255. "email":this.email,
  256. "sex": this.sex,
  257. "avatar": this.userIcon,
  258. "passportPhoto": passportPT+'',
  259. "bankPhoto": this.bankPT,
  260. "merchantType":this.merchantType,
  261. "idNumber":this.idNumber,
  262. "fullName":this.fullName,
  263. "bankAccount":this.bankAccount,
  264. "status": 0
  265. },
  266. res=>{
  267. console.log(res)
  268. uni.navigateBack({
  269. delta:1,//返回层数,2则上上页
  270. })
  271. },failc=>{
  272. //console.log('getadvertis----',failc)
  273. });
  274. },
  275. }
  276. }
  277. </script>
  278. <style>
  279. .imagV{
  280. margin-top: 30rpx;
  281. padding: 8rpx;
  282. width: 120rpx;
  283. height: 120rpx;
  284. border: 2rpx solid darkgray;
  285. }
  286. .yzmctV{
  287. display: flex;
  288. flex-direction: row;
  289. align-items: center;
  290. justify-content: center;
  291. margin-top: 6rpx;
  292. }
  293. .yzmlist{
  294. display: flex;
  295. flex-direction: row;
  296. align-items: center;
  297. justify-content: flex-start;
  298. width: 100%;
  299. margin-top: 6rpx;
  300. padding:10rpx 0 10rpx;
  301. }
  302. .bottomline{
  303. width: 100%;
  304. border: solid lightgray;
  305. border-width: 0px 0px 2rpx 0px;
  306. }
  307. .tittext{
  308. width: 20%;
  309. text-align: right;
  310. }
  311. .noinputV{
  312. width: 70%;
  313. margin-left: 2%;
  314. height: 60rpx;
  315. line-height: 60rpx;
  316. border-radius: 20rpx;
  317. border: 2rpx solid lightgray;
  318. }
  319. .lginputV{
  320. width:610rpx;
  321. height: 60rpx;
  322. line-height: 60rpx;
  323. border-radius: 20rpx;
  324. border: 2rpx solid lightgray;
  325. }
  326. .querenBt{
  327. margin-top: 30rpx;
  328. width: 80%;
  329. height: 60rpx;
  330. line-height: 60rpx;
  331. padding: 10rpx;
  332. border-radius: 20rpx;
  333. border: solid #006AFF;
  334. border-width: 0px 0px 6rpx 0px;
  335. text-align: center;
  336. justify-content: center;
  337. background-color: #006AFF;
  338. color: white;
  339. box-shadow: 0rpx 0rpx 10rpx 0rpx #006AFF;
  340. }
  341. </style>