add-remark.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="user-setting-box">
  3. <!-- #ifndef MP-TOUTIAO -->
  4. <Navbar background-color="#fff" color="#333" title="成长备注"></Navbar>
  5. <!-- #endif -->
  6. <view class="content">
  7. <view class="top-box">
  8. <textarea class="textarea" v-model="form.content" placeholder="点击输入"></textarea>
  9. <MulImgUpload @update="getImgs" :imgs="form.pics" :max="9" :width="100 / 3.75" :height="100 / 3.75"
  10. addColor="#999999">
  11. </MulImgUpload>
  12. </view>
  13. <view class="info-box top-border-radius bottom-border-radius top10">
  14. <view class="label">时间</view>
  15. <view class="right">
  16. <!-- <uni-datetime-picker v-model="form.remarkTime" :border="false" type="date" class="date"/> -->
  17. <uni-datetime-picker v-model="form.remarkTime" :border="false" type="datetime" class="date-box">
  18. <view class="date">
  19. {{form.remarkTime || '请选择时间'}}
  20. <IconText :code="`\ue88e`" class="icon" size="12" color="#C6C5CB"></IconText>
  21. </view>
  22. </uni-datetime-picker>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="fixed-bottom" >
  27. <view class="btn" @click="deleteBabyWeightModal" v-if="id">删除</view>
  28. <view class="solid-btn" @click="handleConfirm">保存</view>
  29. </view>
  30. <ShowModal ref="deletePopup" title="提示" @submit="deleteBabyWeight" leftBtnText="取消" content="是否确认删除?" btnText="确认" />
  31. </view>
  32. </template>
  33. <script lang="ts">
  34. import {
  35. Component,
  36. Mixins
  37. } from 'vue-property-decorator';
  38. import loginMixin from '@/common/mixins/loginMixin.ts';
  39. // import {
  40. // namespace
  41. // } from 'vuex-class';
  42. // const baseModule = namespace('base');
  43. @Component({})
  44. export default class UserSetting extends Mixins(loginMixin) {
  45. // @baseModule.Getter('_userInfo') _userInfo: any;
  46. form: any = {
  47. content: null,
  48. pics: [],
  49. remarkTime: '',
  50. };
  51. bid: any = null;
  52. id: any = null;
  53. onShow() {
  54. }
  55. onLoad(){
  56. this.bid = +this.$Route.query.bid;
  57. if (this.$Route.query.id) {
  58. this.id = +this.$Route.query.id;
  59. this.getBabyRemarkInfo();
  60. }
  61. }
  62. getImgs(pics: any) {
  63. this.form.pics = pics;
  64. }
  65. getBabyRemarkInfo(){
  66. uni.showLoading({
  67. title: '加载中',
  68. });
  69. this.$http.get({
  70. url: this.$api.getBabyRemarkInfo,
  71. data: {
  72. id: this.id
  73. }
  74. }).then((res: any) => {
  75. for(let key in this.form){
  76. this.form[key] = res[key];
  77. }
  78. uni.hideLoading();
  79. })
  80. }
  81. deleteBabyWeightModal(){
  82. (this.$refs.deletePopup as any).open();
  83. }
  84. deleteBabyWeight(){
  85. uni.showLoading({
  86. title: '加载中',
  87. });
  88. this.$http.delete({
  89. url: this.$api.deleteBabyGrowth,
  90. data: {
  91. id: this.id
  92. }
  93. }).then((res: any) => {
  94. this.$Router.back(1);
  95. uni.hideLoading();
  96. })
  97. }
  98. handleConfirm(){
  99. console.log(this.form);
  100. uni.showLoading({
  101. title: '加载中',
  102. });
  103. let url : string = 'addBabyRemark';
  104. let method : string = 'post';
  105. let data: any = {
  106. ...this.form,
  107. bid: this.bid,
  108. };
  109. if (this.id) {
  110. url = 'updateBabyRemark';
  111. method = 'put';
  112. data.id = this.id;
  113. }
  114. this.$http[method]({
  115. url: this.$api[url],
  116. data: data
  117. }).then((res: any) => {
  118. this.$Router.back(1);
  119. uni.hideLoading();
  120. })
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. page{
  126. background: #f5f5f5;
  127. }
  128. .user-setting-box {
  129. // background: #F5F5F5;
  130. height: 100vh;
  131. @include flex-y(flex-start);
  132. .content {
  133. width: 100%;
  134. flex: 1;
  135. // padding: 0 vw(10);
  136. box-sizing: border-box;
  137. @include flex-y(flex-start);
  138. .top-box{
  139. width: vw(355);
  140. background: #fff;
  141. border-radius: vw(10);
  142. margin-top: vw(10);
  143. padding: vw(10);
  144. box-sizing: border-box;
  145. .textarea{
  146. width: 100%;
  147. height: vw(120);
  148. background: #F6F6F6;
  149. padding: vw(8) vw(12);
  150. font-size: vw(14);
  151. box-sizing: border-box;
  152. margin-bottom: vw(16);
  153. }
  154. }
  155. .info-box{
  156. width: vw(355);
  157. height: vw(56);
  158. background: #fff;
  159. @include flex-x();
  160. padding-left: vw(20);
  161. padding-right: vw(10);
  162. box-sizing: border-box;
  163. @include word-vw(14, #333);
  164. margin-top: vw(1);
  165. &.top10{
  166. margin-top: vw(10);
  167. }
  168. &.top-border-radius{
  169. border-top-right-radius: vw(10);
  170. border-top-left-radius: vw(10);
  171. }
  172. &.bottom-border-radius{
  173. border-bottom-right-radius: vw(10);
  174. border-bottom-left-radius: vw(10);
  175. }
  176. .right{
  177. width: vw(210);
  178. @include flex-x(flex-end);
  179. .input{
  180. width: 100%;
  181. height: vw(40);
  182. border-radius: vw(5);
  183. background: #F6F6F6;
  184. text-align: center;
  185. font-size: vw(14);
  186. }
  187. /deep/.uni-date{
  188. @include flex-x(flex-end);
  189. }
  190. .date{
  191. // width: vw(100);
  192. @include flex-x(flex-end);
  193. .icon{
  194. margin-left: vw(3);
  195. }
  196. }
  197. }
  198. }
  199. }
  200. .fixed-bottom {
  201. height: vw(60);
  202. width: 100%;
  203. // background: #fff;
  204. @include flex-x(center);
  205. padding: 0 vw(15);
  206. box-sizing: border-box;
  207. .btn{
  208. @include solid-btn(125, 50, #787878);
  209. border-radius: vw(25);
  210. margin-right: vw(15);
  211. background: #fff;
  212. }
  213. .solid-btn {
  214. background: $bk-color;
  215. @include solid-btn(345, 50, #333);
  216. border-radius: vw(25);
  217. @include word-vw(14, #fff);
  218. flex: 1;
  219. }
  220. }
  221. }
  222. </style>