index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <!-- 菜单悬浮的原理: 通过给菜单添加position:sticky实现, 用法超简单, 仅APP端的低端机不兼容 https://caniuse.com/#feat=css-sticky -->
  2. <template>
  3. <view>
  4. <!-- 对于mescroll-body: 需设置:sticky="true", 此应避免在mescroll-body标签前面加其他非定位的元素, 否则下拉区域会被挤出, 无法会隐藏.-->
  5. <!-- 对于mescroll-uni: 则无需设置:sticky="true", 无其他限制和要求 -->
  6. <!-- sticky吸顶悬浮的菜单, 父元素必须是 mescroll -->
  7. <view class="sticky-tabs">
  8. <me-tabs v-model="tabIndex" nameKey='title' :tabs="tabs" @change="tabChange"></me-tabs>
  9. </view>
  10. <mescroll-body :sticky="true" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
  11. <!-- 数据列表 -->
  12. <view class="margin-sm padding-sm bg radius " v-for="(item,index) in goods" :key='index'
  13. >
  14. <view class="flex justify-between u-border-bottom padding-bottom-sm">
  15. <view class="text-blue">{{item.statusName}}</view>
  16. <view style="color: #1E1F31;">{{item.updateTime}}</view>
  17. </view>
  18. <view class=" u-flex u-p-t-30">
  19. <!-- <view class="u-m-r-10">
  20. <u-avatar :src="avatar" mode="square" size="100"></u-avatar>
  21. </view> -->
  22. <view class="u-flex-1 text-white margin-left-xs">
  23. <view class="u-font-16 text-bold flex justify-between">
  24. <!-- <view>{{item.gameName}}</view> -->
  25. <!-- <view style="display: inline-flex;flex: 2;">
  26. <view class="margin-top-xs text-white text-df" v-for="(item, index) in item.gameName " :key="index" style="margin-right: 10rpx;">{{item}}</view>
  27. </view> -->
  28. <view class="u-line-1" style="width: 460rpx;">{{item.myLevel}}</view>
  29. <view style="flex: 1;text-align: right;">{{item.oldMoney}}元/月</view>
  30. </view>
  31. <view class="u-font-14 u-tips-color margin-top">
  32. <!-- <view class="text-white">接单时间:{{item.orderTakingTime}}</view> -->
  33. <view>
  34. <text v-for="(item,index) in item.gameName" :key="index"
  35. class="margin-right-sm padding-xs"
  36. style="color: #557EFD;background-color: #E1E8FF;">{{item}}</text>
  37. </view>
  38. </view>
  39. <view class="u-font-14 u-tips-color margin-top " v-if="item.content && item.status == 3">
  40. <view class="text-red">拒绝理由:{{item.content}}</view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="flex justify-end u-p-t-20">
  45. <u-button v-if="item.status == 1" class="margin-right-sm" :custom-style="customStyle"
  46. @click="updateStatus(item)" shape="circle" :plain="true">取消审核</u-button>
  47. <u-button v-if="item.status == 0" class="margin-right-sm customStyle2" :custom-style="customStyle"
  48. @click="updateStatus(item)" shape="circle" :plain="true">立即下架</u-button>
  49. <u-button v-if="item.status == 2 || item.status == 3" class="margin-right-sm"
  50. :custom-style="customStyle2" @click="delStatus(item)" shape="circle" :plain="true">删除</u-button>
  51. <u-button v-if="item.status != 0" :custom-style="customStyle2" shape="circle" :plain="true"
  52. @click="update(item)">重新编辑</u-button>
  53. </view>
  54. </view>
  55. <!-- <u-gap height="140" bg-color="#ffffff"></u-gap> -->
  56. <empty v-if="goods.length == 0"></empty>
  57. </mescroll-body>
  58. <view class="padding-lr-sm" style="position: fixed;bottom: 40upx;width: 100%;z-index: 999;">
  59. <u-button class="" :custom-style="customStyle1" :hair-line="false" @click="bindFb()">
  60. <u-icon name="plus" color="#fff" size="30" style="margin-right: 10upx;"></u-icon>
  61. 发布
  62. </u-button>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import MescrollMixin from "@/components/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  68. import mescrollBody from "@/components/mescroll-uni/components/mescroll-body/mescroll-body.vue";
  69. import meTabs from "@/components/mescroll-uni/me-tabs/me-tabs.vue";
  70. import empty from '../../components/empty.vue'
  71. export default {
  72. mixins: [MescrollMixin], // 使用mixin
  73. components: {
  74. mescrollBody,
  75. meTabs,
  76. // orderList
  77. empty
  78. },
  79. data() {
  80. return {
  81. goods: [], // 数据列表
  82. tabs: [{
  83. title: '全部',
  84. status: ''
  85. }, {
  86. title: '进行中',
  87. status: '0'
  88. }, {
  89. title: '待审核',
  90. status: '1'
  91. }, {
  92. title: '已下架',
  93. status: '2'
  94. }, {
  95. title: '已拒绝',
  96. status: '3'
  97. }, ],
  98. tabIndex: 0, // tab下标
  99. game: [],
  100. page: 1,
  101. limit: 10,
  102. userId: 0,
  103. status: 1,
  104. nickName: '',
  105. avatar: '',
  106. customStyle: {
  107. color: '#999999',
  108. border: '2rpx solid #999999',
  109. // backgroundColor: '#1E1F31',
  110. border: "8rpx",
  111. width: '180rpx',
  112. height: '54rpx',
  113. margin: "0 0 0 20rpx"
  114. },
  115. customStyle2: {
  116. color: '#557EFD',
  117. border: '2rpx solid #557EFD',
  118. // backgroundColor: '#1E1F31',
  119. border: "8rpx",
  120. width: '180rpx',
  121. height: '54rpx',
  122. margin: "0 0 0 20rpx"
  123. },
  124. customStyle1: {
  125. backgroundColor: "#557EFD",
  126. color: '#FFFFFF',
  127. border: 0,
  128. color: "#FFF",
  129. height: '98rpx'
  130. },
  131. renzheng: 0
  132. }
  133. },
  134. onLoad() {
  135. this.$queue.showLoading("加载中...");
  136. this.userId = uni.getStorageSync('userId')
  137. this.nickName = uni.getStorageSync('nickName')
  138. // this.getRenZheng()
  139. this.renzheng = uni.getStorageSync("renzheng")
  140. },
  141. onShow() {
  142. this.mescroll.resetUpScroll()
  143. },
  144. methods: {
  145. bindFb() {
  146. // this.renzheng = uni.getStorageSync("renzheng")
  147. if (this.renzheng == 2) {
  148. uni.navigateTo({
  149. url: './editor?classify=' + 1
  150. })
  151. } else if (this.renzheng == 5) {
  152. uni.navigateTo({
  153. url: './firm?classify=' + 2
  154. })
  155. } else {
  156. uni.navigateTo({
  157. url: '/my/renzheng/index?classify=' + 1
  158. })
  159. // uni.showToast({
  160. // title: '您还为实名,请先实名',
  161. // icon: 'none',
  162. // duration: 1000
  163. // })
  164. }
  165. },
  166. /*下拉刷新的回调 */
  167. downCallback() {
  168. // 这里加载你想下拉刷新的数据, 比如刷新轮播数据
  169. // loadSwiper();
  170. // 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
  171. this.mescroll.resetUpScroll()
  172. },
  173. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  174. upCallback(page) {
  175. let curTab = this.tabs[this.tabIndex].status
  176. let data = {
  177. status: curTab,
  178. page: page.num,
  179. limit: page.size
  180. }
  181. this.$Request.get('/app/orderTaking/selectMyRelease', data).then(res => {
  182. uni.hideLoading();
  183. this.mescroll.endBySize(res.data.list.length, res.data.totalCount)
  184. if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
  185. this.goods = [...this.goods, ...res.data.list]; //追加新数据
  186. // for (let i = 0; i < this.goods.length; i++) {
  187. // this.goods[i].gameName = this.goods[i].gameName.split(",");
  188. // console.log(this.goods[i].gameName)
  189. // }
  190. this.goods.forEach(ret => {
  191. ret.gameName = ret.gameName.split(",");
  192. switch (ret.status) {
  193. case '0':
  194. ret.statusName = '进行中';
  195. break;
  196. case '1':
  197. ret.statusName = '待审核';
  198. break;
  199. case '2':
  200. ret.statusName = '已下架';
  201. break;
  202. case '3':
  203. ret.statusName = '已拒绝';
  204. break;
  205. }
  206. })
  207. this.mescroll.endSuccess(res.data.list.length); // 隐藏加载状态栏
  208. }).catch(() => {
  209. //联网失败, 结束加载
  210. this.mescroll.endErr();
  211. });
  212. },
  213. // 切换菜单
  214. tabChange() {
  215. this.goods = []; // 置空列表,显示加载进度条
  216. this.mescroll.resetUpScroll()
  217. },
  218. // 下架
  219. updateStatus(e) {
  220. let data = {
  221. id: e.id,
  222. status: '2'
  223. }
  224. this.$Request.get('/app/orderTaking/updateTakingStatus', data).then(res => {
  225. if (res.code == 0) {
  226. this.mescroll.resetUpScroll()
  227. }
  228. })
  229. },
  230. // 重新编辑
  231. update(e) {
  232. console.log(e)
  233. if (this.renzheng != 2 && this.renzheng != 5) {
  234. uni.showToast({
  235. title: '请先完成实名认证',
  236. icon: 'none',
  237. duration: 1000
  238. })
  239. } else {
  240. if (this.renzheng == 2) {
  241. if (e.authentication == 2) {
  242. uni.showToast({
  243. title: '当前为个人已实名状态,不可发布企业订单',
  244. icon: 'none',
  245. duration: 1000
  246. })
  247. } else if (e.authentication == 1) {
  248. uni.navigateTo({
  249. url: '/my/publish/editor?id=' + e.id
  250. })
  251. }
  252. } else if (this.renzheng == 5) {
  253. if (e.authentication == 1) {
  254. uni.showToast({
  255. title: '当前为企业已实名状态,不可发布个人订单',
  256. icon: 'none',
  257. duration: 1000
  258. })
  259. } else if (e.authentication == 2) {
  260. uni.navigateTo({
  261. url: '/my/publish/firm?id=' + e.id
  262. })
  263. }
  264. }
  265. }
  266. },
  267. //删除
  268. delStatus(e) {
  269. let that = this
  270. uni.showModal({
  271. title: '提示',
  272. content: '确定删除吗?',
  273. success: function(res) {
  274. if (res.confirm) {
  275. let data = {
  276. id: e.id
  277. }
  278. that.$Request.get('/app/orderTaking/deleteTaking', data).then(res => {
  279. uni.showToast({
  280. title: "删除成功"
  281. })
  282. that.mescroll.resetUpScroll()
  283. })
  284. } else if (res.cancel) {
  285. console.log('用户点击取消');
  286. }
  287. }
  288. });
  289. },
  290. // 完善需求
  291. edit(item) {
  292. uni.navigateTo({
  293. url: '/pages/order/release?type=hasEdit&id=' + item.id + '&content=' + item.content +
  294. '&site=' + item.site +
  295. '&phone=' + item.phone + '&deliveryTime=' + item.deliveryTime + '&classifyId=' + item
  296. .classifyId +
  297. '&classifyName=' + item.classifyName + '&userType=' + item.userType + '&commission=' + item
  298. .commission + '&image=' + item.image + '&address=' + item.address + '&latitude=' + item
  299. .latitude + '&longitude=' + item.longitude
  300. })
  301. },
  302. clickItem: function(e) {
  303. console.log('点击', e)
  304. uni.navigateTo({
  305. url: '/pages/index/order/order?id=' + e.orderTakingId + '&userId=' + e.userId
  306. });
  307. },
  308. goNav(e) {
  309. uni.navigateTo({
  310. url: e
  311. })
  312. }
  313. }
  314. }
  315. </script>
  316. <style lang="scss">
  317. /*
  318. sticky生效条件:
  319. 1、父元素不能overflow:hidden或者overflow:auto属性。(mescroll-body设置:sticky="true"即可, mescroll-uni本身没有设置overflow)
  320. 2、必须指定top、bottom、left、right4个值之一,否则只会处于相对定位
  321. 3、父元素的高度不能低于sticky元素的高度
  322. 4、sticky元素仅在其父元素内生效,所以父元素必须是 mescroll
  323. */
  324. .sticky-tabs {
  325. z-index: 990;
  326. position: sticky;
  327. top: var(--window-top);
  328. // background-color: #fff;
  329. }
  330. // 使用mescroll-uni,则top为0
  331. .mescroll-uni,
  332. /deep/.mescroll-uni {
  333. .sticky-tabs {
  334. top: 0;
  335. }
  336. }
  337. .demo-tip {
  338. padding: 18upx;
  339. font-size: 24upx;
  340. text-align: center;
  341. }
  342. page {
  343. background-color: #F5F5F5;
  344. }
  345. .bg {
  346. background-color: #FFFFFF;
  347. }
  348. </style>