index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view class="content">
  3. <view class="one">
  4. <input type="text" v-model="searchInfo.goods" @input="toInput" placeholder="搜索商品">
  5. </view>
  6. <view class="two">
  7. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
  8. <view class="list-scroll-view">
  9. <view class="list" v-for="(item,index) in list" :key="index" @tap="toInfo(item)">
  10. <view class="list_1">
  11. <text>
  12. <text class="iconfont icon-changshangguanli"></text>
  13. {{item.supplier_name}}
  14. </text>
  15. <text class="status">{{item.zhStatus}}</text>
  16. </view>
  17. <view class="list_2">
  18. <view class="left">
  19. <image v-if="item.spec_file" class="image" :src="item.spec_file?item.spec_file.url:''"
  20. mode="">
  21. </image>
  22. <image v-else class="image" :src="item.good_file?item.good_file.url:''" mode="">
  23. </image>
  24. </view>
  25. <view class="right">
  26. <view class="right_1">
  27. <view class="name textOver">
  28. <text>{{item.good_name||'暂无'}}</text>
  29. </view>
  30. <view class="num">
  31. <text>¥{{item.total_money||'0'}}</text>
  32. <text>×{{item.num||'0'}}</text>
  33. </view>
  34. </view>
  35. <view class="right_2">
  36. <view class="spec textOver">
  37. <text>规格:</text>
  38. <text>{{item.spec_name||'暂无'}}</text>
  39. </view>
  40. <view class="spec textOver">
  41. <text>购买用户:</text>
  42. <text>{{item.user_name||'暂无'}}</text>
  43. </view>
  44. <view class="spec textOver">
  45. <text>用户角色:</text>
  46. <text>{{item.zhRole||'暂无'}}</text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="bottom" v-if="item.status=='-7'||item.status=='-8'">
  52. <button size="mini" type="default" @tap.stop="toExam(item)">重新申请回款</button>
  53. </view>
  54. </view>
  55. <view class="is_bottom" v-if="is_bottom">
  56. <text>{{config.bottom_title}}</text>
  57. </view>
  58. </view>
  59. </scroll-view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. // 系统设置
  68. config: {},
  69. user: {},
  70. searchInfo: {},
  71. list: [],
  72. total: 0,
  73. skip: 0,
  74. limit: 6,
  75. page: 0,
  76. // 数据是否触底
  77. is_bottom: false,
  78. scrollTop: 0,
  79. // 字典表
  80. statusList: [],
  81. roleList: []
  82. }
  83. },
  84. onLoad: function(e) {
  85. const that = this;
  86. that.searchConfig();
  87. },
  88. onShow: async function(e) {
  89. const that = this;
  90. await that.searchOther();
  91. that.searchToken();
  92. },
  93. onPullDownRefresh: async function() {
  94. const that = this;
  95. that.clearPage();
  96. await that.search();
  97. uni.stopPullDownRefresh();
  98. },
  99. methods: {
  100. searchConfig() {
  101. const that = this;
  102. try {
  103. const res = uni.getStorageSync('config');
  104. if (res) that.$set(that, `config`, res);
  105. } catch (e) {
  106. uni.showToast({
  107. title: err.errmsg,
  108. icon: 'error',
  109. duration: 2000
  110. });
  111. }
  112. },
  113. searchToken() {
  114. const that = this;
  115. try {
  116. const res = uni.getStorageSync('token');
  117. if (res) {
  118. that.$set(that, `user`, res);
  119. that.clearPage();
  120. that.search();
  121. }
  122. } catch (e) {
  123. uni.showToast({
  124. title: err.errmsg,
  125. icon: 'error',
  126. duration: 2000
  127. });
  128. }
  129. },
  130. async search() {
  131. const that = this;
  132. let user = that.user;
  133. let info = {
  134. skip: that.skip,
  135. limit: that.limit,
  136. supplier: user._id,
  137. };
  138. let res;
  139. res = await that.$api(`/OrderDetail/money`, 'GET', {
  140. ...info,
  141. ...that.searchInfo
  142. });
  143. if (res.errcode == '0') {
  144. let list = [...that.list, ...res.data];
  145. for (let val of list) {
  146. val.zhStatus = that.searchDict(val.status, 'status')
  147. val.zhRole = that.searchDict(val.user_role, 'role')
  148. }
  149. that.$set(that, `list`, list);
  150. that.$set(that, `total`, res.total)
  151. } else {
  152. uni.showToast({
  153. title: res.errmsg,
  154. icon: 'none'
  155. })
  156. }
  157. },
  158. // 查看详情
  159. toInfo(e) {
  160. uni.navigateTo({
  161. url: `/pagesMy/order/detail?id=${e.id||e._id}`
  162. })
  163. },
  164. // 查询字典表
  165. searchDict(e, model) {
  166. const that = this;
  167. let data
  168. if (model == 'status') {
  169. data = that.statusList.find((i) => i.value == e);
  170. if (data) return data.label
  171. else return '暂无'
  172. } else if (model == 'role') {
  173. data = that.roleList.find((i) => i.code == e);
  174. if (data) return data.name
  175. else return '暂无'
  176. }
  177. },
  178. // 分页
  179. toPage(e) {
  180. const that = this;
  181. let list = that.list;
  182. let limit = that.limit;
  183. if (that.total > list.length) {
  184. uni.showLoading({
  185. title: '加载中',
  186. mask: true
  187. })
  188. let page = that.page + 1;
  189. that.$set(that, `page`, page)
  190. let skip = page * limit;
  191. that.$set(that, `skip`, skip)
  192. that.search();
  193. uni.hideLoading();
  194. } else that.$set(that, `is_bottom`, true)
  195. },
  196. // 触底
  197. toScroll(e) {
  198. const that = this;
  199. let up = that.scrollTop;
  200. that.$set(that, `scrollTop`, e.detail.scrollTop);
  201. let num = Math.sign(up - e.detail.scrollTop);
  202. if (num == 1) that.$set(that, `is_bottom`, false);
  203. },
  204. // 输入框
  205. toInput(e) {
  206. const that = this;
  207. if (that.searchInfo.goods) that.$set(that.searchInfo, `goods`, e.detail.value)
  208. else that.$set(that, `searchInfo`, {})
  209. that.clearPage();
  210. that.search();
  211. },
  212. // 审批
  213. async toExam(item) {
  214. const that = this;
  215. let user = that.user;
  216. let obj = {
  217. status: '6'
  218. };
  219. uni.showModal({
  220. title: '提示',
  221. content: '确定重新申请该订单吗?',
  222. success: async function(res) {
  223. if (res.confirm) {
  224. const res = await that.$api(`/OrderDetail/${item._id}`, 'POST', obj);
  225. if (res.errcode == '0') {
  226. uni.showToast({
  227. title: '维护信息成功',
  228. icon: 'none'
  229. })
  230. that.clearPage()
  231. that.search()
  232. } else {
  233. uni.showToast({
  234. title: res.errmsg,
  235. icon: 'none'
  236. })
  237. }
  238. }
  239. }
  240. });
  241. },
  242. // 查询其他信息
  243. async searchOther() {
  244. const that = this;
  245. let res;
  246. // 查询状态
  247. res = await that.$api(`/DictData`, 'GET', {
  248. type: 'order_status'
  249. })
  250. if (res.errcode == '0') that.$set(that, `statusList`, res.data);
  251. // 查询角色
  252. res = await that.$api(`/Role`, 'GET', {
  253. is_use: '0',
  254. })
  255. if (res.errcode == '0') that.$set(that, `roleList`, res.data);
  256. },
  257. // 清空列表
  258. clearPage() {
  259. const that = this;
  260. that.$set(that, `list`, [])
  261. that.$set(that, `skip`, 0)
  262. that.$set(that, `limit`, 6)
  263. that.$set(that, `page`, 0)
  264. }
  265. }
  266. }
  267. </script>
  268. <style lang="scss">
  269. .content {
  270. display: flex;
  271. flex-direction: column;
  272. width: 100vw;
  273. height: 100vh;
  274. .one {
  275. padding: 2vw;
  276. input {
  277. padding: 2vw;
  278. background-color: var(--f1Color);
  279. font-size: var(--font14Size);
  280. border-radius: 5px;
  281. }
  282. }
  283. .two {
  284. position: relative;
  285. flex-grow: 1;
  286. background-color: var(--f9Color);
  287. .list {
  288. background-color: #fff;
  289. border: 1px solid var(--f5Color);
  290. padding: 2vw;
  291. margin: 2vw 2vw 0 2vw;
  292. border-radius: 5px;
  293. .list_1 {
  294. display: flex;
  295. justify-content: space-between;
  296. padding: 2vw 0;
  297. font-size: var(--font16Size);
  298. .status {
  299. font-size: var(--font14Size);
  300. color: var(--fF0Color);
  301. }
  302. }
  303. .list_2 {
  304. display: flex;
  305. .left {
  306. .image {
  307. width: 20vw;
  308. height: 20vw;
  309. border-radius: 5px;
  310. border: 1px solid var(--f9Color);
  311. }
  312. }
  313. .right {
  314. width: 70vw;
  315. margin: 0 0 0 2vw;
  316. .right_1 {
  317. display: flex;
  318. justify-content: space-between;
  319. margin: 2vw 0;
  320. .name {
  321. font-size: var(--font14Size);
  322. }
  323. .num {
  324. display: flex;
  325. flex-direction: column;
  326. align-items: flex-end;
  327. text:last-child {
  328. font-size: var(--font13Size);
  329. color: var(--f85Color);
  330. }
  331. }
  332. }
  333. .right_2 {
  334. font-size: var(--font12Size);
  335. .spec {
  336. text:first-child {
  337. color: var(--f85Color);
  338. }
  339. }
  340. }
  341. }
  342. }
  343. .bottom {
  344. text-align: center;
  345. padding: 1vw 0;
  346. button {
  347. margin: 0 5px 0 0;
  348. }
  349. }
  350. }
  351. }
  352. }
  353. .scroll-view {
  354. position: absolute;
  355. top: 0;
  356. left: 0;
  357. right: 0;
  358. bottom: 0;
  359. .list-scroll-view {
  360. display: flex;
  361. flex-direction: column;
  362. }
  363. }
  364. .is_bottom {
  365. width: 100%;
  366. text-align: center;
  367. text {
  368. padding: 2vw 0;
  369. display: inline-block;
  370. color: var(--f85Color);
  371. font-size: var(--font14Size);
  372. }
  373. }
  374. </style>