index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }"
  3. :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  4. <tm-menubars title="添加成员" :shadow="0" :showback="true"></tm-menubars>
  5. <div class="zhuti">
  6. <tm-sheet class="kuang" style="padding-bottom: 70px !important;">
  7. <view>
  8. <view>
  9. <!-- <view class="fl zuo" style="width:70px;">
  10. <view class="flex-center flex-col mt-30" style="position: relative;" v-for="(item,index) in reqData.role">
  11. <image @click="qiehuanren(index)" block v-if="index==0" mode="widthFix" src="/static/img/53.png"></image>
  12. <image @click="qiehuanren(index)" block v-else mode="widthFix" src="/static/img/61.png"></image>
  13. <tm-badges icon="icon-times" @click="shanchu(item.timestamp)" v-if="(show==index && index !=0)"></tm-badges>
  14. </view>
  15. <view class="flex-center flex-col mt-30" style="position: relative;" v-if="reqData.role.length<4">
  16. <image block mode="widthFix" src="/static/img/54.png" @click="add()"></image>
  17. </view>
  18. </view> -->
  19. <view class="fr you black mt-30" style="width: 92%;">
  20. <tm-input :required="true" title="用户名" v-model="reqData.username" placeholder="你想叫自己什么" align="right"></tm-input>
  21. <tm-input :required="true" title="身高(cm)" v-model="reqData.height" align="right"></tm-input>
  22. <tm-input :required="true" title="体重(kg)" v-model="reqData.weight" align="right"></tm-input>
  23. <tm-pickers class="tan" :default-value.sync="reqData.body_arr" rang-key="title" :list="chelianglis">
  24. <tm-input name="shencai" title="身材" placeholder="请选择身材" disabled :value="obTstr2(reqData.body_arr)" right-icon="icon-angle-right"></tm-input>
  25. </tm-pickers>
  26. </view>
  27. </view>
  28. <view style="clear: both;"></view>
  29. <view class="anniu">
  30. <tm-button v-if="id != ''" @click="quxiao()" theme="gray" size="n">删除</tm-button>
  31. <tm-button @click="tijiao()" class="fr" theme="primary" size="n">确认</tm-button>
  32. </view>
  33. <!-- <tm-button :round="24" class="sao mb-40" style="margin-top: 50px;" @click="tijiao()" block>保存</tm-button> -->
  34. </view>
  35. </tm-sheet>
  36. </div>
  37. <!-- 弹出层消息 -->
  38. <tm-message ref="toast"></tm-message>
  39. </view>
  40. </template>
  41. <script>
  42. import{myRequest} from '@/api/request.js'
  43. export default {
  44. data() {
  45. return {
  46. active:1,
  47. chelianglis:[
  48. {title:"标准",id:1},
  49. {title:"偏瘦",id:2},
  50. {title:"偏胖",id:3},
  51. {title:"梨形",id:4}
  52. ],
  53. show:0,
  54. reqData:{
  55. family_id:uni.getStorageSync("family_id"),
  56. username:'',
  57. weight:'',
  58. height:'',
  59. body_type:'',
  60. body_arr:[]
  61. },
  62. id:''
  63. };
  64. },
  65. onLoad(e) {
  66. this.reqData.username=e.username;
  67. this.reqData.weight=e.weight;
  68. this.reqData.height=e.height;
  69. this.reqData.body_type=e.body_type;
  70. this.id=e.id?e.id:'';
  71. if(e.body_type){
  72. this.reqData.body_arr.push(this.chelianglis[e.body_type])
  73. }
  74. console.log(this.id)
  75. },
  76. created() {
  77. this.sys = uni.getSystemInfoSync();
  78. },
  79. methods: {
  80. qiehuanren(index){
  81. this.show=index;
  82. },
  83. quyifu(){
  84. uni.navigateTo({
  85. url: "/pages/luru/index",
  86. })
  87. },
  88. quindex(){
  89. uni.navigateTo({
  90. url: "/pages/index/index",
  91. })
  92. },
  93. tijiao(){
  94. var that=this;
  95. if(this.reqData.username==""){
  96. that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
  97. return;
  98. }if(this.reqData.weight==""){
  99. that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
  100. return;
  101. }if(this.reqData.height==""){
  102. that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
  103. return;
  104. }
  105. if(this.reqData.body_arr.length !=0){
  106. this.reqData.body_type=this.reqData.body_arr[0].id;
  107. }
  108. if(that.id){
  109. this.reqData.id=that.id;
  110. var url="/api/MemberInfo/updateMemberInfo";
  111. }else{
  112. var url="/api/MemberInfo/addOneMemberInfo";
  113. }
  114. myRequest({
  115. url:url ,
  116. method:'post',
  117. data:that.reqData
  118. }).then(res => {
  119. console.log(res.data)
  120. if (res.data.code == 200) {
  121. let pages = getCurrentPages(); // 当前页面
  122. let beforePage = pages[pages.length - 2]; // 前一个页面
  123. uni.navigateBack({
  124. delta: 1,
  125. success: function() {
  126. beforePage.$vm.getDate()
  127. }
  128. });
  129. }else{
  130. that.$refs.toast.show({model:'error',label:res.data.msg})
  131. }
  132. })
  133. },
  134. quxiao(){
  135. var that=this;
  136. myRequest({
  137. url: "/api/MemberInfo/deleteMemberInfo",
  138. method:'post',
  139. data:{id:that.id}
  140. }).then(res => {
  141. console.log(res.data)
  142. if (res.data.code == 200) {
  143. let pages = getCurrentPages(); // 当前页面
  144. let beforePage = pages[pages.length - 2]; // 前一个页面
  145. uni.navigateBack({
  146. delta: 1,
  147. success: function() {
  148. beforePage.$vm.getDate()
  149. }
  150. });
  151. }else{
  152. that.$refs.toast.show({model:'error',label:res.data.msg})
  153. }
  154. })
  155. },
  156. obTstr2(o){
  157. if(Array.isArray(o)){
  158. if(o.length.length===0) return "";
  159. return o[0]?.title??""
  160. }
  161. return ''
  162. },
  163. saoma(){
  164. var that=this;
  165. uni.scanCode({
  166. scanType: ['barCode'],
  167. success: function (res) {
  168. console.log('条码类型:' + res.scanType);
  169. console.log('条码内容:' + res.result);
  170. that.reqData.wardrode_no=res.result;
  171. that.active=2;
  172. },
  173. error : function(e) {
  174. alert("网络异常,请重试");
  175. }
  176. })
  177. },
  178. chuangjianFun(){
  179. var that=this;
  180. if(that.reqData.familyname==""){
  181. that.$refs.toast.show({model:'warn',label:'请输入家庭名称'})
  182. return
  183. }
  184. that.active=3;
  185. }
  186. },
  187. }
  188. </script>
  189. <style lang="scss">
  190. .zhanshi{
  191. width: 100%;
  192. margin: 0 auto;
  193. margin-top: 10px;
  194. margin-bottom: 40px;
  195. }
  196. /deep/ .tm-menubars .body{
  197. background-color: #1b1b1b !important;
  198. }
  199. /deep/ .kuang{margin:0 !important;padding: 14px !important;margin-bottom: 40px !important;}
  200. .jindu{width: 90%;margin: 0 auto;display: block;}
  201. .wenzi{width: 94%;margin: 0 auto;}
  202. .nicheng{width: 130px;height:132px;display: block;margin:0 auto;margin-top: 50px;}
  203. /deep/ .shuru .grey-darken-5{
  204. background-color: #0d0d0d!important;
  205. padding: 0px !important;
  206. }
  207. .shuru{border:1px solid #303030;border-radius: 10px;}
  208. /deep/ .shuru .text-primary.bk{color:#303030 !important;}
  209. /deep/ .shuru .border-grey-darken-4-b-1{border-bottom:none !important;}
  210. .zuo image{width:60px;display: block;}
  211. .you{border:1px solid #303030;border-radius: 10px;padding:10px;height: 300px;}
  212. /deep/ .you .grey-darken-5{
  213. background-color: #0d0d0d!important;
  214. padding: 0px !important;
  215. }
  216. /deep/ .you .text-red{color: white;}
  217. /deep/ .tan .active{background-color: #AAAAAA !important;}
  218. /deep/ .tan .tm-poups .grey-darken-5{background-color: gray !important;}
  219. /deep/ .tan uni-input{text-align: right;}
  220. /deep/ .you .border-grey-darken-4-b-1 {
  221. border-bottom: solid 1px #313131 !important;
  222. }
  223. /deep/ .tm--badges{position: absolute;top: 0px;right:6px}
  224. .logincla{margin-top: 100px;}
  225. /deep/ .quindex uni-button{background-color: #0A84FF !important;}
  226. .anniu{width: 80%;margin: 0 auto;margin-top: 20px;}
  227. /deep/ .anniu .gray.bk{color: white !important;}
  228. </style>