index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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" :defaultSelect="0"
  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_1">
  46. <view class="order_info title">品牌:{{ item.dictLabel || '-' }}</view>
  47. </view>
  48. <view class="order_col_2">
  49. <view class="order_info">付款方式:{{ payTypeFormatter(item.payType) || '-' }}</view>
  50. <view class="order_info">开单人:{{ item.recyclePerson || '-' }}</view>
  51. <view class="order_info">开单数量:{{ item.quantity || '-' }}</view>
  52. <view class="order_info">开单日期:{{ orderDateFormatter(item.orderDate) || '-' }}</view>
  53. <view class="order_info">订单类型:{{ orderTypeFormatter(item.orderType) || '-' }}</view>
  54. <view class="order_info">商品分类:{{ typeFormatter(item.type) || '-' }}</view>
  55. <view class="order_info money">成交金额:{{ item.dealPrice || '-' }}元</view>
  56. <view class="order_info money">实收总计:{{ item.amountReceived || '-' }}元</view>
  57. </view>
  58. <view class="order_col_1">
  59. <view class="order_info">开单备注:{{ item.orderRemark || '-' }}</view>
  60. <view class="order_info">收货地址:{{ item.address || '-' }}</view>
  61. <view class="order_info">售后保障配置:{{ afterSaleTabFormatter(item.afterSaleTab) || '-' }}</view>
  62. <view class="order_info scroll_img">支付凭证图片:
  63. <ImgsRowScroll v-if="item.payTypeProofPicFileList.length > 0" imgMode="aspectFill"
  64. :totalWidth="400" :images="item.payTypeProofPicFileList" :previewEnabled="true"
  65. :imageWidth="150" :imageHeight="150"></ImgsRowScroll>
  66. <text v-else>暂无图片</text>
  67. </view>
  68. </view>
  69. </u-swipe-action-item>
  70. </u-swipe-action>
  71. </view>
  72. <u-empty v-if="orderList.length === 0" mode="search"></u-empty>
  73. </scroll-view>
  74. </view>
  75. </u-popup>
  76. </template>
  77. <script>
  78. import ImgsRowScroll from '@/components/imgs-row-scroll/index.vue'
  79. import { afterSaleTabList,paymentTabList,shortTimeList } from '../../js/public.js'
  80. import jtimePickerPopup from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue';
  81. import Cell from '@/components/custom-cell/index.vue'
  82. import PersonPicker from '@/components/person-picker/index.vue'
  83. import TabSelect from '@/components/custom-tab-select/index.vue'
  84. import OrderListEdit from './edit.vue'
  85. export default {
  86. name: 'OrderList',
  87. components: {
  88. ImgsRowScroll,
  89. jtimePickerPopup,
  90. Cell,
  91. PersonPicker,
  92. TabSelect,
  93. OrderListEdit,
  94. },
  95. data() {
  96. return {
  97. show: false,
  98. orderList: [],
  99. searchInfo: {
  100. pageNum: 1,
  101. pageSize: 10,
  102. dictLabel: '',
  103. time: '',
  104. startTime: '',
  105. endTime: '',
  106. recyclePerson: '',
  107. recyclePersonId: '',
  108. type:[]
  109. },
  110. total: 0,
  111. orderTypeList: [],
  112. typeList: [],
  113. searchShow: false,
  114. deleteShow: false,
  115. shortTimeList: shortTimeList,
  116. swipeOptions: [
  117. {
  118. text: '编辑',
  119. style: {
  120. backgroundColor: '#409eff'
  121. }
  122. },
  123. {
  124. text: '删除',
  125. style: {
  126. backgroundColor: '#f56c6c'
  127. }
  128. },
  129. ],
  130. curInfo: {},
  131. // 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'],
  132. }
  133. },
  134. props: {
  135. },
  136. emits: [],
  137. methods: {
  138. confirmEdit(){
  139. this.searchOrderList()
  140. },
  141. handleSwipeClick(e, item) {
  142. this.curInfo = item;
  143. this.$nextTick(()=>{
  144. if(e.index == 0){
  145. this.$refs.orderListEditRef.showModal();
  146. } else if(e.index == 1){//删除
  147. this.deleteShow = true;
  148. }
  149. })
  150. },
  151. confirmDelete() {
  152. uni.$u.api.wareHouseOrderDelete({
  153. id: this.curInfo.id
  154. }).then(() => {
  155. uni.$u.toast('删除成功');
  156. this.deleteShow = false;
  157. this.show = false;
  158. this.searchOrderList();
  159. }).catch(err => {
  160. uni.$u.toast(err || '删除失败');
  161. });
  162. },
  163. cancelDelete(){
  164. this.deleteShow = false;
  165. },
  166. clear(val){
  167. if(val == 'time'){
  168. this.searchInfo.time = '';
  169. this.searchInfo.startTime = '';
  170. this.searchInfo.endTime = '';
  171. }
  172. if(val == 'recyclePerson'){
  173. this.searchInfo.recyclePerson = '';
  174. this.searchInfo.recyclePersonId = '';
  175. }
  176. },
  177. getSelectTime(val) {
  178. this.searchInfo.startTime = this.$dayjs(val.beginTime).format('YYYY-MM-DD');
  179. this.searchInfo.endTime = this.$dayjs(val.endTime).format('YYYY-MM-DD');
  180. this.searchInfo.time = this.$dayjs(val.beginTime).format('YYYY-MM-DD') + ' 至 ' + this.$dayjs(val.endTime).format('YYYY-MM-DD');
  181. this.searchOrderList();
  182. },
  183. openSearchModal() {
  184. this.searchShow = true;
  185. this.$nextTick(() => {
  186. this.$refs.jtimePickerPopupRef.handleInit();
  187. })
  188. },
  189. closeSearchModal() {
  190. this.searchShow = false;
  191. },
  192. openTimePicker() {
  193. this.$refs.jtimePickerPopupRef.pickerShow();
  194. },
  195. openRecyclePersonPicker() {
  196. this.$refs.recyclePersonPickerRef.open();
  197. },
  198. handleSelectRecyclePerson(person) {
  199. this.searchInfo.recyclePerson = person.label;
  200. this.searchInfo.recyclePersonId = person.id;
  201. },
  202. handleTabChangeType(val){
  203. this.searchInfo.type = val
  204. },
  205. loadMore() {
  206. if (this.orderList.length >= this.total){
  207. uni.$u.toast('没有更多了');
  208. return;
  209. };
  210. this.searchInfo.pageNum++;
  211. this.getOrderList();
  212. },
  213. payTypeFormatter(type) {
  214. return paymentTabList.find(tab => tab.value == type)?.name || '-';
  215. },
  216. afterSaleTabFormatter(tabs) {
  217. let tabNames = [];
  218. tabs.forEach(item => {
  219. tabNames.push(afterSaleTabList.find(tab => tab.value == item)?.name || '-');
  220. })
  221. return tabNames.join('、');
  222. },
  223. async getOrderType(){
  224. this.orderTypeList = await this.$getDicts("crm_sendOrder_type");
  225. },
  226. orderTypeFormatter(type) {
  227. const obj = this.orderTypeList.find(item => item.dictValue == type) || {};
  228. return obj.dictLabel || '-';
  229. },
  230. async getTypeList(){
  231. this.typeList = await this.$getDicts("crm_form_category");
  232. },
  233. typeFormatter(type) {
  234. const obj = this.typeList.find(item => item.dictValue == type) || {};
  235. return obj.dictLabel || '-';
  236. },
  237. orderDateFormatter(date) {
  238. if (!date) return '-';
  239. return this.$dayjs(date).format('YYYY-MM-DD');
  240. },
  241. searchOrderList() {
  242. this.searchInfo.pageNum = 1;
  243. this.getOrderList();
  244. },
  245. submitSearch() {
  246. this.searchShow = false;
  247. this.searchOrderList();
  248. },
  249. resetForm() {
  250. this.searchInfo.time = ''
  251. this.searchInfo.startTime = ''
  252. this.searchInfo.endTime = ''
  253. this.searchInfo.recyclePerson = ''
  254. this.searchInfo.recyclePersonId = ''
  255. this.searchInfo.type = []
  256. },
  257. getOrderList() {
  258. uni.$u.api.wareHouseOrderList({
  259. pageNum: this.searchInfo.pageNum,
  260. pageSize: this.searchInfo.pageSize,
  261. dictLabel: this.searchInfo.dictLabel || '',
  262. startTime: this.searchInfo.startTime || '',
  263. endTime: this.searchInfo.endTime || '',
  264. recyclePerson: this.searchInfo.recyclePerson || '',
  265. recyclePersonId: this.searchInfo.recyclePersonId || '',
  266. type: this.searchInfo.type || [],
  267. }).then(res => {
  268. if(res.rows.length == 0){
  269. uni.$u.toast("暂无订单");
  270. this.orderList = [];
  271. this.total = 0;
  272. return;
  273. }
  274. if (this.searchInfo.pageNum === 1) {
  275. this.orderList = res.rows;
  276. } else {
  277. this.orderList = this.orderList.concat(res.rows);
  278. }
  279. this.total = res.total || 0;
  280. })
  281. },
  282. openList() {
  283. this.show = true;
  284. this.resetForm();
  285. this.searchInfo.pageNum = 1;
  286. this.searchInfo.pageSize = 10;
  287. this.getOrderList();
  288. this.getOrderType();
  289. this.getTypeList();
  290. },
  291. hideList() {
  292. this.show = false;
  293. },
  294. }
  295. }
  296. </script>
  297. <style lang="scss" scoped>
  298. @import '../../styles/orderList/index.scss';
  299. </style>