OrderInfo.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="order-info bg-white">
  3. <view class="info-item flex">
  4. <text class="label">订单编号</text>
  5. <text style="color:#22ac38" class="flex-1 text-center content" @click="copyToClipboard(detail.orderId)">{{
  6. detail.orderId }}</text>
  7. </view>
  8. <view class="info-item">
  9. <text class="label">预估金额</text>
  10. <text class="content">{{ detail.expectMoney }}</text>
  11. <text class="label border-left">审核金额</text>
  12. <text class="content">{{ detail.finalMoney }}</text>
  13. </view>
  14. <view class="info-item">
  15. <text class="label">用户备注</text>
  16. <text class="content">{{ detail.userRemark}}</text>
  17. </view>
  18. <view class="info-item" @click="handleRemark">
  19. <text class="label">内部备注</text>
  20. <text class="content">{{ detail?.manageRemark ? detail?.manageRemark.length > 0 ?
  21. detail?.manageRemark[0]?.remark: ' ' : ' ' }}</text>
  22. </view>
  23. <view class="info-item">
  24. <text class="label">订单状态</text>
  25. <text class="content" style="color: #c5493e;">[{{ statusText }}]</text>
  26. </view>
  27. <view class="info-item">
  28. <text class="label">快递</text>
  29. <text class="content">{{ finalExpressText }}<text style="color: #409eef;" @click="copyToClipboard(detail.waybillCode)">(单号:{{ detail.waybillCode }})</text></text>
  30. </view>
  31. <view class="info-item">
  32. <text class="label">发件人<text style="color: #e99d42;">(所有单)</text></text>
  33. <view class="content flex flex-a-c flex-j-c">
  34. <text class="content-text" @click="copyToClipboard(detail.sendMobile)">复制</text>
  35. <text class="content-text ml-10 mr-10">{{ maskedSendMobile }}</text>
  36. <u-icon v-if="detail.orderFrom == 1" name="weixin-circle-fill" size="18" color="#22ac38"></u-icon>
  37. <u-icon v-if="detail.orderFrom == 2" name="zhifubao-circle-fill" size="18" color="#999"></u-icon>
  38. </view>
  39. </view>
  40. <view class="info-item">
  41. <text class="label">发货地址</text>
  42. <text class="content">{{ detail.sendAddress }}</text>
  43. </view>
  44. <view class="info-item">
  45. <text class="label">收货仓库</text>
  46. <text class="content">{{ detail.recipientAddress }}-{{ detail.recipientGodown }}-{{ detail.recipientName
  47. }}</text>
  48. </view>
  49. </view>
  50. <u-modal :show="showModal" title="编辑内部备注" :showCancelButton="true" @confirm="confirmRemark"
  51. @cancel="handleCancel">
  52. <view class="modal-content w100" @click="playGlobalSound">
  53. <u-textarea v-model="internalRemark" placeholder="编辑内部备注" autoHeight
  54. style="min-height: 100px;"></u-textarea>
  55. <view class="mt-20 common-title">快速填入</view>
  56. <view class="quick-fill mt-16">
  57. <u-tag class="mr-10 mb-10" @click="fillRemark('少书给客服')" text="少书给客服"></u-tag>
  58. <u-tag class="mr-10 mb-10" @click="fillRemark('多书给客服')" text="多书给客服"></u-tag>
  59. <u-tag class="mr-10 mb-10" @click="fillRemark('子母件')" text="子母件"></u-tag>
  60. <u-tag class="mr-10 mb-10" @click="fillRemark('书单不符给客服')" text="书单不符给客服"></u-tag>
  61. <u-tag class="mr-10 mb-10" @click="fillRemark('需理赔给客服')" text="需理赔给客服"></u-tag>
  62. </view>
  63. </view>
  64. </u-modal>
  65. </template>
  66. <script setup>
  67. import { defineProps, computed, ref, watch } from 'vue';
  68. const props = defineProps({
  69. orderId: String,
  70. estimatedAmount: Number,
  71. userNote: String,
  72. detail: Object,
  73. // Add more props as needed
  74. });
  75. let finalExpressList = { '1': '顺丰快递', '2': '京东快递', '3': '德邦快递' }
  76. let finalExpressText = computed(() => {
  77. return props.detail.finalExpress ? finalExpressList[props.detail.finalExpress] : ''
  78. });
  79. function playGlobalSound(){
  80. uni.$u.playClickSound()
  81. }
  82. const statusEnum = {
  83. 0: '创建',
  84. 1: '用户删除',
  85. 2: '下单(待初审)',
  86. 3: '初审(待取书)',
  87. 4: '初审未通过',
  88. 5: '快递取书(待签收)',
  89. 6: '快递签收(待收货)',
  90. 7: '物流签收(路由异常)',
  91. 8: '仓库收货(待审核)',
  92. 9: '审核中(审核未提交)',
  93. 10: '已审核(待付款)',
  94. 11: '已完成'
  95. };
  96. let statusText = computed(() => {
  97. return statusEnum[props.detail.status] || '未知状态';
  98. });
  99. const maskedSendMobile = computed(() => {
  100. if (props.detail.sendMobile && props.detail.sendMobile.length === 11) {
  101. return props.detail.sendMobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
  102. }
  103. return props.detail.sendMobile;
  104. });
  105. function copyToClipboard(text) {
  106. uni.setClipboardData({
  107. data: text,
  108. success: function () {
  109. uni.showToast({
  110. title: '复制成功',
  111. icon: 'success'
  112. });
  113. },
  114. fail: function (err) {
  115. console.error('Could not copy text: ', err);
  116. }
  117. });
  118. }
  119. const showModal = ref(false);
  120. const internalRemark = ref('');
  121. function fillRemark(text) {
  122. internalRemark.value = text;
  123. }
  124. const remarkInfo = ref({});
  125. function handleRemark() {
  126. showModal.value = true;
  127. remarkInfo.value = props.detail.manageRemark?.[0] || {};
  128. internalRemark.value = remarkInfo.value.remark || '';
  129. }
  130. //关闭弹窗
  131. function handleCancel(){
  132. showModal.value = false
  133. playGlobalSound()
  134. }
  135. const emit = defineEmits(['refresh']);
  136. function confirmRemark() {
  137. playGlobalSound()
  138. // Logic to save the remark
  139. uni.$u.http.post('/app/orderinfo/setManageRemark', {
  140. orderId: props.detail.orderId,
  141. remark: internalRemark.value,
  142. id: remarkInfo.value.id
  143. }).then(res => {
  144. if (res.code == 200) {
  145. uni.$u.toast('保存成功')
  146. uni.$u.ttsModule.speak('保存成功')
  147. showModal.value = false;
  148. emit('refresh')
  149. } else {
  150. uni.$u.toast(res.msg)
  151. }
  152. })
  153. }
  154. </script>
  155. <style lang="scss" scoped>
  156. .order-info {
  157. .info-item {
  158. display: flex;
  159. align-items: center;
  160. line-height: 42rpx;
  161. border-bottom: 1rpx solid #e5e5e5;
  162. font-size: 28rpx;
  163. }
  164. .label {
  165. width: 120px;
  166. text-align: center;
  167. padding: 20rpx 0;
  168. height: 100%;
  169. }
  170. .content {
  171. text-align: center;
  172. padding: 20rpx 20rpx;
  173. flex: 1;
  174. border-left: 1rpx solid #e5e5e5;
  175. min-height: 42px;
  176. box-sizing: border-box;
  177. }
  178. .border-left {
  179. border-left: 1rpx solid #e5e5e5;
  180. }
  181. .quick-fill {
  182. display: flex;
  183. flex-wrap: wrap;
  184. gap: 20rpx;
  185. .u-tag {
  186. margin: 0 10rpx 10rpx 0;
  187. }
  188. }
  189. }
  190. </style>