index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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. is_use: '0',
  250. })
  251. if (res.errcode == '0') that.$set(that, `statusList`, res.data);
  252. // 查询角色
  253. res = await that.$api(`/Role`, 'GET', {
  254. is_use: '0',
  255. })
  256. if (res.errcode == '0') that.$set(that, `roleList`, res.data);
  257. },
  258. // 清空列表
  259. clearPage() {
  260. const that = this;
  261. that.$set(that, `list`, [])
  262. that.$set(that, `skip`, 0)
  263. that.$set(that, `limit`, 6)
  264. that.$set(that, `page`, 0)
  265. }
  266. }
  267. }
  268. </script>
  269. <style lang="scss">
  270. .content {
  271. display: flex;
  272. flex-direction: column;
  273. width: 100vw;
  274. height: 100vh;
  275. .one {
  276. padding: 2vw;
  277. input {
  278. padding: 2vw;
  279. background-color: var(--f1Color);
  280. font-size: var(--font14Size);
  281. border-radius: 5px;
  282. }
  283. }
  284. .two {
  285. position: relative;
  286. flex-grow: 1;
  287. background-color: var(--f9Color);
  288. .list {
  289. background-color: #fff;
  290. border: 1px solid var(--f5Color);
  291. padding: 2vw;
  292. margin: 2vw 2vw 0 2vw;
  293. border-radius: 5px;
  294. .list_1 {
  295. display: flex;
  296. justify-content: space-between;
  297. padding: 2vw 0;
  298. font-size: var(--font16Size);
  299. .status {
  300. font-size: var(--font14Size);
  301. color: var(--fF0Color);
  302. }
  303. }
  304. .list_2 {
  305. display: flex;
  306. .left {
  307. .image {
  308. width: 20vw;
  309. height: 20vw;
  310. border-radius: 5px;
  311. border: 1px solid var(--f9Color);
  312. }
  313. }
  314. .right {
  315. width: 70vw;
  316. margin: 0 0 0 2vw;
  317. .right_1 {
  318. display: flex;
  319. justify-content: space-between;
  320. margin: 2vw 0;
  321. .name {
  322. font-size: var(--font14Size);
  323. }
  324. .num {
  325. display: flex;
  326. flex-direction: column;
  327. align-items: flex-end;
  328. text:last-child {
  329. font-size: var(--font13Size);
  330. color: var(--f85Color);
  331. }
  332. }
  333. }
  334. .right_2 {
  335. font-size: var(--font12Size);
  336. .spec {
  337. text:first-child {
  338. color: var(--f85Color);
  339. }
  340. }
  341. }
  342. }
  343. }
  344. .bottom {
  345. text-align: center;
  346. padding: 1vw 0;
  347. button {
  348. margin: 0 5px 0 0;
  349. }
  350. }
  351. }
  352. }
  353. }
  354. .scroll-view {
  355. position: absolute;
  356. top: 0;
  357. left: 0;
  358. right: 0;
  359. bottom: 0;
  360. .list-scroll-view {
  361. display: flex;
  362. flex-direction: column;
  363. }
  364. }
  365. .is_bottom {
  366. width: 100%;
  367. text-align: center;
  368. text {
  369. padding: 2vw 0;
  370. display: inline-block;
  371. color: var(--f85Color);
  372. font-size: var(--font14Size);
  373. }
  374. }
  375. </style>