index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <u-popup :show="show" @close="openList" @open="openList" mode="right" customStyle="width: 100vw;">
  3. <view class="order_list">
  4. <u-navbar class="nav-bar" title="开单记录" :autoBack="false" :placeholder="true" v-hideNav
  5. @leftClick="hideList"></u-navbar>
  6. <view class="search_form">
  7. <u-search placeholder="请输入品牌名称" v-model="searchInfo.dictLabel" :showCancel="true" @custom="searchOrderList"></u-search>
  8. <view @click="openSearchModal">
  9. <u-icon name="grid" size="20" color="#666666"></u-icon>
  10. </view>
  11. </view>
  12. <!-- 筛选 -->
  13. <u-popup mode="bottom" :round="10" :show="searchShow" closeable @close="closeSearchModal">
  14. <u-form class="search_pop" labelPosition="left" :model="searchInfo" ref="uForm">
  15. <u-form-item label="时间范围" labelWidth="70" @click="openTimePicker">
  16. <Cell :val="searchInfo.time" :isDelete="true" :border="true" @handleClear="clear('time')"></Cell>
  17. <jtimePickerPopup :isShowShortTimeList="true" shortTimeTitle="快捷时间" :shortTimeList="shortTimeList"
  18. :isShowSeletTimeTitle="true" seletTimeTitle="时间选择" cancelText="取消" confirmText="确认"
  19. :endSelectMonth="-1" :endSelectDay="-1" beginTimePlaceHolder='开始时间' endTimePlaceHolder="结束时间"
  20. :isDateTypeRange="true" :isShowSelectedTimeEcho="true" @confirm="getSelectTime"
  21. ref="jtimePickerPopupRef">
  22. </jtimePickerPopup>
  23. </u-form-item>
  24. <u-form-item label="开单人" @click="openRecyclePersonPicker" labelWidth="70">
  25. <Cell :val="searchInfo.recyclePerson" :isDelete="true" :border="true" @handleClear="clear('recyclePerson')"></Cell>
  26. <PersonPicker ref="recyclePersonPickerRef" title="请选择开单人" @selectPerson="handleSelectRecyclePerson"></PersonPicker>
  27. </u-form-item>
  28. <u-form-item label="物品分类" labelWidth="70">
  29. <TabSelect :tabList="typeList" :echoInfo="searchInfo.type" :colNum="4" mode="multiple" labelKey="dictLabel" valueKey="dictValue" @tabChange="handleTabChangeType"></TabSelect>
  30. </u-form-item>
  31. </u-form>
  32. <view class="btns">
  33. <u-button text="重置" @click="resetForm"></u-button>
  34. <u-button type="primary" text="确定" @click="submitSearch"></u-button>
  35. </view>
  36. </u-popup>
  37. <!-- 删除二次确认 -->
  38. <u-modal :show="deleteShow" title="确认要删除该订单吗?" :showCancelButton="true" @confirm="confirmDelete" @cancel="cancelDelete"></u-modal>
  39. <!-- 编辑弹窗 -->
  40. <OrderListEdit ref="orderListEditRef" title="编辑" :orderInfo="curInfo" @confirm="confirmEdit"></OrderListEdit>
  41. <scroll-view class="list_wrap" scroll-y @scrolltolower="loadMore" enable-back-to-top>
  42. <view class="order_item" v-for="(item, index) in orderList" :key="index">
  43. <u-swipe-action>
  44. <u-swipe-action-item :options="swipeOptions" @click="(e) => handleSwipeClick(e, item)">
  45. <view class="order_col_2">
  46. <view class="order_info">品牌:{{ item.dictLabel || '-' }}</view>
  47. <view class="order_info">付款方式:{{ payTypeFormatter(item.payType) || '-' }}</view>
  48. <view class="order_info">开单人:{{ item.recyclePerson || '-' }}</view>
  49. <view class="order_info">开单数量:{{ item.quantity || '-' }}</view>
  50. <view class="order_info">开单日期:{{ orderDateFormatter(item.orderDate) || '-' }}</view>
  51. <view class="order_info">订单类型:{{ orderTypeFormatter(item.orderType) || '-' }}</view>
  52. <view class="order_info">商品分类:{{ typeFormatter(item.type) || '-' }}</view>
  53. <view class="order_info">成交金额:{{ item.dealPrice || '-' }}元</view>
  54. <view class="order_info">实收总计:{{ item.amountReceived || '-' }}元</view>
  55. </view>
  56. <view class="order_col_1">
  57. <view class="order_info">开单备注:{{ item.orderRemark || '-' }}</view>
  58. <view class="order_info">收货地址:{{ item.address || '-' }}</view>
  59. <view class="order_info">售后保障配置:{{ afterSaleTabFormatter(item.afterSaleTab) || '-' }}</view>
  60. <view class="order_info scroll_img">支付凭证图片:
  61. <ImgsRowScroll v-if="item.payTypeProofPicFileList.length > 0" imgMode="aspectFill"
  62. :totalWidth="400" :images="item.payTypeProofPicFileList" :previewEnabled="true"
  63. :imageWidth="150" :imageHeight="150"></ImgsRowScroll>
  64. <text v-else>暂无图片</text>
  65. </view>
  66. </view>
  67. </u-swipe-action-item>
  68. </u-swipe-action>
  69. </view>
  70. <u-empty v-if="orderList.length === 0" mode="search"></u-empty>
  71. </scroll-view>
  72. </view>
  73. </u-popup>
  74. </template>
  75. <script>
  76. import ImgsRowScroll from '@/components/imgs-row-scroll/index.vue'
  77. import { afterSaleTabList,paymentTabList,shortTimeList } from '../../js/public.js'
  78. import jtimePickerPopup from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue';
  79. import Cell from '@/components/custom-cell/index.vue'
  80. import PersonPicker from '@/components/person-picker/index.vue'
  81. import TabSelect from '@/components/custom-tab-select/index.vue'
  82. import OrderListEdit from './edit.vue'
  83. export default {
  84. name: 'OrderList',
  85. components: {
  86. ImgsRowScroll,
  87. jtimePickerPopup,
  88. Cell,
  89. PersonPicker,
  90. TabSelect,
  91. OrderListEdit,
  92. },
  93. data() {
  94. return {
  95. show: false,
  96. orderList: [],
  97. searchInfo: {
  98. pageNum: 1,
  99. pageSize: 10,
  100. dictLabel: '',
  101. time: '',
  102. startTime: '',
  103. endTime: '',
  104. recyclePerson: '',
  105. recyclePersonId: '',
  106. type:[]
  107. },
  108. total: 0,
  109. orderTypeList: [],
  110. typeList: [],
  111. searchShow: false,
  112. deleteShow: false,
  113. shortTimeList: shortTimeList,
  114. swipeOptions: [
  115. {
  116. text: '编辑',
  117. style: {
  118. backgroundColor: '#409eff'
  119. }
  120. },
  121. {
  122. text: '删除',
  123. style: {
  124. backgroundColor: '#f56c6c'
  125. }
  126. },
  127. ],
  128. curInfo: {},
  129. // payTypeProofPicFileList: ['https://xiaohulu-crm.oss-cn-shanghai.aliyuncs.com/crm/2026/01/28/1769587638946-mosaic-1769587638729.jpeg','https://xiaohulu-crm.oss-cn-shanghai.aliyuncs.com/crm/2026/01/28/1769587638946-mosaic-1769587638729.jpeg','https://xiaohulu-crm.oss-cn-shanghai.aliyuncs.com/crm/2026/01/28/1769587638946-mosaic-1769587638729.jpeg','https://xiaohulu-crm.oss-cn-shanghai.aliyuncs.com/crm/2026/01/28/1769587638946-mosaic-1769587638729.jpeg','https://xiaohulu-crm.oss-cn-shanghai.aliyuncs.com/crm/2026/01/28/1769587638946-mosaic-1769587638729.jpeg'],
  130. }
  131. },
  132. props: {
  133. },
  134. emits: [],
  135. methods: {
  136. confirmEdit(){
  137. this.searchOrderList()
  138. },
  139. handleSwipeClick(e, item) {
  140. this.curInfo = item;
  141. this.$nextTick(()=>{
  142. if(e.index == 0){
  143. this.$refs.orderListEditRef.showModal();
  144. } else if(e.index == 1){//删除
  145. this.deleteShow = true;
  146. }
  147. })
  148. },
  149. confirmDelete() {
  150. uni.$u.api.wareHouseOrderDelete({
  151. id: this.curInfo.id
  152. }).then(() => {
  153. uni.$u.toast('删除成功');
  154. this.deleteShow = false;
  155. this.show = false;
  156. this.searchOrderList();
  157. }).catch(err => {
  158. uni.$u.toast(err || '删除失败');
  159. });
  160. },
  161. cancelDelete(){
  162. this.deleteShow = false;
  163. },
  164. clear(val){
  165. if(val == 'time'){
  166. this.searchInfo.time = '';
  167. this.searchInfo.startTime = '';
  168. this.searchInfo.endTime = '';
  169. }
  170. if(val == 'recyclePerson'){
  171. this.searchInfo.recyclePerson = '';
  172. this.searchInfo.recyclePersonId = '';
  173. }
  174. },
  175. getSelectTime(val) {
  176. this.searchInfo.startTime = this.$dayjs(val.beginTime).format('YYYY-MM-DD');
  177. this.searchInfo.endTime = this.$dayjs(val.endTime).format('YYYY-MM-DD');
  178. this.searchInfo.time = this.$dayjs(val.beginTime).format('YYYY-MM-DD') + ' 至 ' + this.$dayjs(val.endTime).format('YYYY-MM-DD');
  179. this.searchOrderList();
  180. },
  181. openSearchModal() {
  182. this.searchShow = true;
  183. this.$nextTick(() => {
  184. this.$refs.jtimePickerPopupRef.handleInit();
  185. })
  186. },
  187. closeSearchModal() {
  188. this.searchShow = false;
  189. },
  190. openTimePicker() {
  191. this.$refs.jtimePickerPopupRef.pickerShow();
  192. },
  193. openRecyclePersonPicker() {
  194. this.$refs.recyclePersonPickerRef.open();
  195. },
  196. handleSelectRecyclePerson(person) {
  197. this.searchInfo.recyclePerson = person.label;
  198. this.searchInfo.recyclePersonId = person.id;
  199. },
  200. handleTabChangeType(val){
  201. this.searchInfo.type = val
  202. },
  203. loadMore() {
  204. if (this.orderList.length >= this.total){
  205. uni.$u.toast('没有更多了');
  206. return;
  207. };
  208. this.searchInfo.pageNum++;
  209. this.getOrderList();
  210. },
  211. payTypeFormatter(type) {
  212. return paymentTabList.find(tab => tab.value == type)?.name || '-';
  213. },
  214. afterSaleTabFormatter(tabs) {
  215. let tabNames = [];
  216. tabs.forEach(item => {
  217. tabNames.push(afterSaleTabList.find(tab => tab.value == item)?.name || '-');
  218. })
  219. return tabNames.join('、');
  220. },
  221. async getOrderType(){
  222. this.orderTypeList = await this.$getDicts("crm_sendOrder_type");
  223. },
  224. orderTypeFormatter(type) {
  225. const obj = this.orderTypeList.find(item => item.dictValue == type) || {};
  226. return obj.dictLabel || '-';
  227. },
  228. async getTypeList(){
  229. this.typeList = await this.$getDicts("crm_form_category");
  230. },
  231. typeFormatter(type) {
  232. const obj = this.typeList.find(item => item.dictValue == type) || {};
  233. return obj.dictLabel || '-';
  234. },
  235. orderDateFormatter(date) {
  236. if (!date) return '-';
  237. return this.$dayjs(date).format('YYYY-MM-DD');
  238. },
  239. searchOrderList() {
  240. this.searchInfo.pageNum = 1;
  241. this.getOrderList();
  242. },
  243. submitSearch() {
  244. this.searchShow = false;
  245. this.searchOrderList();
  246. },
  247. resetForm() {
  248. this.searchInfo.time = ''
  249. this.searchInfo.startTime = ''
  250. this.searchInfo.endTime = ''
  251. this.searchInfo.recyclePerson = ''
  252. this.searchInfo.recyclePersonId = ''
  253. this.searchInfo.type = []
  254. },
  255. getOrderList() {
  256. uni.$u.api.wareHouseOrderList({
  257. pageNum: this.searchInfo.pageNum,
  258. pageSize: this.searchInfo.pageSize,
  259. dictLabel: this.searchInfo.dictLabel || '',
  260. startTime: this.searchInfo.startTime || '',
  261. endTime: this.searchInfo.endTime || '',
  262. recyclePerson: this.searchInfo.recyclePerson || '',
  263. recyclePersonId: this.searchInfo.recyclePersonId || '',
  264. type: this.searchInfo.type || [],
  265. }).then(res => {
  266. if(res.rows.length == 0){
  267. uni.$u.toast("暂无订单");
  268. this.orderList = [];
  269. this.total = 0;
  270. return;
  271. }
  272. if (this.searchInfo.pageNum === 1) {
  273. this.orderList = res.rows;
  274. } else {
  275. this.orderList = this.orderList.concat(res.rows);
  276. }
  277. this.total = res.total || 0;
  278. })
  279. },
  280. openList() {
  281. this.show = true;
  282. this.resetForm();
  283. this.searchInfo.pageNum = 1;
  284. this.searchInfo.pageSize = 10;
  285. this.getOrderList();
  286. this.getOrderType();
  287. this.getTypeList();
  288. },
  289. hideList() {
  290. this.show = false;
  291. },
  292. }
  293. }
  294. </script>
  295. <style lang="scss" scoped>
  296. @import '../../styles/orderList/index.scss';
  297. </style>