my.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template name="my">
  2. <view>
  3. <view class="grace-list">
  4. <view class="grace-list-items">
  5. <view class="grace-list-image ucenter-face grace-relative">
  6. <image class="grace-list-image ucenter-face-image" :src="fetch.user.avatar" mode="widthFix" @click="avatarSet(0)"></image>
  7. <avatar @upload="avatarUpload" ref="avatar"></avatar>
  8. </view>
  9. <view class="grace-list-body">
  10. <view class="grace-list-title">
  11. <text class="grace-list-title-text">{{fetch.user.username}}<text v-if="fetch.user.title" style="margin-left:10rpx">({{fetch.user.title}})</text> </text>
  12. </view>
  13. <view class="grace-list-body-desc">{{fetch.user.info}}</view>
  14. </view>
  15. <text class="grace-list-arrow-right grace-icons icon-arrow-right" style="display:none;"></text>
  16. </view>
  17. </view>
  18. <view class="ucenter-line" v-if="fetch.num.length > 0"></view>
  19. <view v-if="fetch.num.length > 0">
  20. <graceBoxBanner :items="fetch.num" @taped="showScore"></graceBoxBanner>
  21. </view>
  22. <graceDialog :isTitle="true" :title="scoreTitle" :isCloseBtn="true" :show="score" closeBtnColor="#FFFFFF" v-on:closeDialog="closeScore">
  23. <scroll-view :scroll-y="true" class="padding" slot="content" style="height:800rpx;" @scrolltolower="nextScore">
  24. <view class="zhList padding margin-tb" v-for="(v, k) in fetch.score" :key="k">
  25. <view class="flex justify-between">
  26. <view class="text-black font-30 block margin-bottom-xs text-bold">{{v.title}}</view>
  27. <view class="text-bold text-red" v-if="v.status == 2">-{{v.num}}</view>
  28. <view class="text-bold text-blue" v-if="v.status == 1">+{{v.num}}</view>
  29. </view>
  30. <view class="text-999 flex justify-between margin-top align-center">
  31. <text class="font-24" v-if="v.total >= 0">余额:{{v.total}}</text>
  32. <text class="font-24" v-if="v.price">金额:{{v.price}}</text>
  33. <text class="font-24 block">{{v.cdate}}</text>
  34. </view>
  35. </view>
  36. </scroll-view>
  37. <view slot="btns" class="grace-space-between">
  38. <text class="grace-dialog-buttons" @tap="closeScore">关闭</text>
  39. <text class="grace-dialog-buttons grace-blue" @tap="tixian" v-if="scoreType == 'yue'">提现</text>
  40. <text class="grace-dialog-buttons grace-blue" @tap="duihuan" v-if="scoreType == 'score'">兑换</text>
  41. <text class="grace-dialog-buttons grace-blue" @tap="zengsong" v-if="scoreType == 'ticket1'">赠送</text>
  42. </view>
  43. </graceDialog>
  44. <view class="ucenter-line"></view>
  45. <view class="grace-list grace-margin-top">
  46. <view class="card-bottom">
  47. <!-- 顶部分页栏 -->
  48. <view class="top-tab">
  49. <view :class="['tab-item flex-center', activeTab == k ? 'active' : '']" @tap="handleTab(k)" v-for="(v, k) in cate" :key="k">{{ v }}</view>
  50. </view>
  51. <view class="scroll-wrapper">
  52. <view class="margin-bottom">
  53. <view class="cu-list menu-avatar" v-if="activeTab == 1">
  54. <view class="cu-item " v-for="(v, k) in fetch.order" :key="k">
  55. <view class="cu-avatar radius lg" :style="{backgroundImage:'url('+v.pic+')'}"></view>
  56. <view class="content">
  57. <view class="text-pink"><view class="text-cut">{{v.name}}</view></view>
  58. <view class="text-gray text-sm flex"> <view class="text-cut">{{v.date}}</view></view>
  59. </view>
  60. <view class="action" style="width:120rpx;">
  61. <view class="text-grey text-xs">{{v.price}}</view>
  62. <view class="cu-tag round bg-red sm" v-if="v.shape == 2">查看详情</view>
  63. <view class="cu-tag round bg-black sm" v-else-if="v.mode == 2">查看自提码</view>
  64. <view class="cu-tag round bg-blue sm" v-else>{{v.status_name}}</view>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="cu-list menu-avatar" v-if="activeTab == 2">
  69. <view class="cu-item" v-for="(v, k) in fetch.chat" :key="k" @click="goChat(v.uid, v.user.username)">
  70. <view class="cu-avatar round lg" :style="{backgroundImage:'url('+v.user.avatar+')'}">
  71. <view class="cu-tag badge" style="display:none;">99+</view>
  72. </view>
  73. <view class="content">
  74. <view class="text-grey">
  75. <view class="text-cut">{{v.user.username}}</view>
  76. <view class="cu-tag round bg-orange sm" v-if="v.user.title">{{v.user.title}}</view>
  77. </view>
  78. <view class="text-gray text-sm flex" v-if="v.chat.text">
  79. <view class="text-cut">
  80. {{v.chat.text}}
  81. </view>
  82. </view>
  83. </view>
  84. <view class="action" style="width: auto;">
  85. <view class="cu-tag round text-grey sm">{{v.chat.day}}</view>
  86. <view class="text-grey text-xs">{{v.chat.date}}</view>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="cu-list menu-avatar" v-if="activeTab == 0">
  91. <form @submit="formSubmit" class="grace-form grace-margin-top">
  92. <view class="grace-form-item grace-border-b">
  93. <text class="grace-form-label">昵称</text>
  94. <view class="grace-form-body">
  95. <input type="text" class="grace-form-input" name="name" placeholder="请填写有趣儿的昵称" v-model="fetch.user.username"></input>
  96. </view>
  97. </view>
  98. <view class="grace-form-item grace-border-b">
  99. <text class="grace-form-label">头衔</text>
  100. <view class="grace-form-body">
  101. <input type="text" class="grace-form-input" name="title" placeholder="请填写头衔" v-model="fetch.user.title"></input>
  102. </view>
  103. </view>
  104. <view class="grace-form-item grace-border-b">
  105. <text class="grace-form-label">签名</text>
  106. <view class="grace-form-body">
  107. <input type="text" class="grace-form-input" name="info" placeholder="请填写签名" v-model="fetch.user.info"></input>
  108. </view>
  109. </view>
  110. <view style="padding:30rpx 0;">
  111. <button formType="submit" type="primary" class="grace-button grace-border-radius">保存</button>
  112. </view>
  113. </form>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. var graceChecker = require("@/lib/graceUI/jsTools/graceChecker.js");
  123. import avatar from "@/lib/yq-avatar/yq-avatar.vue";
  124. export default {
  125. name: "cate",
  126. props: {
  127. content_id : {
  128. type : String,
  129. value : null
  130. },
  131. width : {
  132. type : String,
  133. default : '100%'
  134. },
  135. param : {},
  136. index : 0
  137. },
  138. data() {
  139. return {
  140. fetch : {
  141. user : {},
  142. num : [],
  143. order : [],
  144. chat : [],
  145. score : [],
  146. },
  147. activeTab : 0,
  148. //关系
  149. cate : [
  150. '个人资料', '购物订单'
  151. ],
  152. openAvatar : false,
  153. score : false,
  154. scoreType : 'yue',
  155. scoreTitle : '',
  156. scoreIndex : 0,
  157. }
  158. },
  159. mounted() {
  160. this.getData();
  161. },
  162. methods:{
  163. tixian : function() {
  164. this.Dever.alert('敬请期待');
  165. },
  166. duihuan : function() {
  167. this.Dever.alert('敬请期待');
  168. },
  169. showScore : function(index) {
  170. this.scoreIndex = index;
  171. var info = this.fetch.num[this.scoreIndex];
  172. var title = info[2] + ':' + info[0];
  173. this.getScore(1, info[0], info[3], title);
  174. },
  175. nextScore : function() {
  176. var info = this.fetch.num[this.scoreIndex];
  177. var title = info[2] + ':' + info[0];
  178. this.getScore(2, info[0], info[3], title);
  179. },
  180. getScore : function(page, num, method, title) {
  181. var self = this;
  182. this.Dever.page([page, 'score'], this, 'app/user/?l=api.score', {code:this.Dever.config.code,method:method}, function(t) {
  183. if (t.score.length > 0) {
  184. self.fetch.score = t.score;
  185. } else {
  186. self.Dever.alert('无记录');
  187. }
  188. self.scoreType = t.type;
  189. self.scoreTitle = title;
  190. self.score = true;
  191. }, function(t) {
  192. self.Dever.alert('无记录');
  193. });
  194. },
  195. closeScore : function() {
  196. this.score = false;
  197. },
  198. getData : function() {
  199. if (this.openAvatar) {
  200. return;
  201. } else {
  202. uni.stopPullDownRefresh();
  203. }
  204. var self = this;
  205. this.Dever.get(this, 'app/user/?l=api.get', {code:this.Dever.config.code, noloading:1});
  206. this.handleTab(this.activeTab);
  207. },
  208. getInfo : function(t) {
  209. //触底刷新
  210. this.handleTab(this.activeTab, 2);
  211. },
  212. getOrder : function(page) {
  213. this.Dever.page([page,'order'], this, 'app/user/?l=api.my_goods_order', {code:this.Dever.config.code, noloading:1});
  214. },
  215. getCommunity : function(page) {
  216. this.Dever.page([page,'chat'], this, 'app/user/?l=api.community', {code:this.Dever.config.code, noloading:1});
  217. },
  218. goChat : function(uid, username) {
  219. this.Dever.location('chat/user?uid=' + uid + '&code=' + this.Dever.config.code + '&title=' + username);
  220. },
  221. handleTab : function(k, t) {
  222. this.activeTab = k;
  223. if (!t) {
  224. t = 1;
  225. }
  226. if (k == 1) {
  227. this.getOrder(t);
  228. } else if(k == 2) {
  229. this.getCommunity(t);
  230. }
  231. },
  232. // 表单提交
  233. formSubmit : function(e) {
  234. var self = this;
  235. var rule = [
  236. { name: "name", checkType: "string", checkRule: "1,10", errorMsg: "昵称应为1-20个字符" },
  237. ];
  238. var formData = e.detail.value;
  239. var checkRes = graceChecker.check(formData, rule);
  240. if (checkRes) {
  241. formData.code = this.Dever.config.code;
  242. this.Dever.post('app/user/?l=api.up', formData, function(t) {
  243. self.Dever.alert('保存成功');
  244. });
  245. } else {
  246. self.Dever.alert(graceChecker.error);
  247. }
  248. },
  249. avatarUpload : function(e) {
  250. var self = this;
  251. this.openAvatar = false;
  252. this.Dever.uploadFile(e.path, 'avatar', 1, function(type, file) {
  253. self.fetch.user.avatar = file;
  254. self.Dever.post('app/user/?l=api.upAvatar', {avatar:file, noloading:1});
  255. });
  256. },
  257. avatarSet : function(index) {
  258. this.openAvatar = true;
  259. this.$refs.avatar.fChooseImg(index,{
  260. selWidth: "300rpx", selHeight: "300rpx",
  261. expWidth: '260rpx', expHeight: '260rpx',
  262. avatarSrc : this.fetch.user.avatar,
  263. bgImage : this.fetch.user.avatar,
  264. noTab : true,
  265. });
  266. }
  267. },
  268. components:{
  269. avatar
  270. }
  271. }
  272. </script>
  273. <style>
  274. .ucenter-face{width:100rpx !important; height:100rpx !important;}
  275. .ucenter-face-image{width:100rpx !important; height:100rpx !important;}
  276. .ucenter-line{height:12rpx; background-color:#f8f8f8; margin:16rpx 0;}
  277. .card-bottom {
  278. width: 100%;
  279. }
  280. .top-tab {
  281. display: flex;
  282. height: 120rpx;
  283. position: relative;
  284. top: 0;
  285. left: 0;
  286. width: 100%;
  287. z-index: 100;
  288. background-color: #ffffff;
  289. }
  290. .tab-item {
  291. flex: 1;
  292. color: #999;
  293. border-bottom: 4rpx solid #ececec;
  294. }
  295. .active {
  296. color: var(--mainColor);
  297. border-bottom: 4rpx solid var(--mainColor);
  298. }
  299. .flex-center {
  300. display: flex;
  301. align-items: center;
  302. justify-content: center;
  303. }
  304. .grace-form-input {
  305. text-align: left;
  306. }
  307. .top{ background-color: #FB5858;}
  308. .btnOne{width:300rpx;height:80rpx;background:rgba(255,255,255,1);box-shadow:0rpx 2rpx 24rpx 0rpx rgba(251,88,88,1);border-radius:40rpx;}
  309. .line{width:1rpx;height:43rpx;background:rgba(255,255,255,1);}
  310. .zhList1{background:rgba(255,255,255,1);box-shadow:1px 5px 24px 0px rgba(161,161,161,0.38);border-radius:5px;}
  311. .zhList{background:rgba(255,255,255,1);border-bottom:1px solid rgba(161,161,161,0.38);}
  312. .text-91b{ color: #21A91B;}
  313. .text-101{ color: #FF0101;}
  314. .erro-404 {padding-bottom: 100upx;}
  315. .erro-404 image {width: 260upx; height: 260upx;}
  316. .font-24 {font-size: 12px;}
  317. .text-999 {color: #999;}
  318. </style>