pageOne.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view class="page-itemOne">
  3. <u-row justify="space-between" customStyle="margin-bottom: 10px">
  4. <u-col span="3">
  5. <div class="page-itemOne-title">图片资料</div>
  6. </u-col>
  7. <u-col span="3.5">
  8. <u-button size="small" @click="copyAllImages"
  9. style="border-radius: 20rpx;border-color: #007AFF;color: #007AFF;">复制全部图片</u-button>
  10. </u-col>
  11. </u-row>
  12. <!-- 实物图卡片 -->
  13. <view class="card_wrap">
  14. <view class="card-title">实物图</view>
  15. <view class="image-upload-container">
  16. <view class="image-list">
  17. <view class="image-item" v-for="(item, index) in trueUploadList" :key="'truePic-' + index">
  18. <pic-comp :src="item.fileUrl"></pic-comp>
  19. <view class="delete-btn" @click="deleteImage(item)">×</view>
  20. </view>
  21. <view class="upload-btn" @click="uploadImage('truePic', currentReceipt.id)">
  22. <u-icon name="plus" size="40" color="#999"></u-icon>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 聊天记录卡片 -->
  28. <view class="card_wrap">
  29. <view class="card-title">聊天记录</view>
  30. <view class="image-upload-container">
  31. <view class="image-list">
  32. <view class="image-item" v-for="(item, index) in chatRecordsUploadList"
  33. :key="'chatRecords-' + index">
  34. <pic-comp :src="item.fileUrl"></pic-comp>
  35. <view class="delete-btn" @click="deleteImage(item)">×</view>
  36. </view>
  37. <view class="upload-btn" @click="uploadImage('chatRecords', currentReceipt.id)">
  38. <u-icon name="plus" size="40" color="#999"></u-icon>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 基本信息卡片 -->
  44. <view class="info-card">
  45. <view class="info-card-title">基本信息</view>
  46. <u-row class="info-row">
  47. <u-col span="6">
  48. <view class="info-label">发单人</view>
  49. <view class="info-value">{{ orderDetail.createNickName || '未填写' }}</view>
  50. </u-col>
  51. <u-col span="6">
  52. <view class="info-label">型号</view>
  53. <view class="info-value">{{ orderDetail.model || '未填写' }}</view>
  54. </u-col>
  55. </u-row>
  56. <u-row class="info-row">
  57. <u-col span="6">
  58. <view class="info-label">上门时间</view>
  59. <view class="info-value">{{ orderDetail.visitTime || '未填写' }}</view>
  60. </u-col>
  61. <u-col span="6">
  62. <view class="info-label">地址</view>
  63. <view class="info-value">{{ orderDetail.address || '未填写' }}</view>
  64. </u-col>
  65. </u-row>
  66. </view>
  67. <!-- 联系方式卡片 -->
  68. <view class="connect">
  69. <view class="connect-card phone-card" @click="handlePhoneClick">
  70. <u-icon name="phone" size="40" color="#07C160" style="margin-bottom: 10rpx;"></u-icon>
  71. <view class="connect-title">电话</view>
  72. <!-- 小红点 -->
  73. <view v-if="orderDetail.phone" class="red-dot"></view>
  74. </view>
  75. <view class="connect-card wechat-card" @click="handleWechatClick">
  76. <u-icon name="chat" size="40" color="#07C160" style="margin-bottom: 10rpx;"></u-icon>
  77. <view class="connect-title">微信</view>
  78. <!-- 小红点 -->
  79. <view v-if="orderDetail.wechat" class="red-dot"></view>
  80. </view>
  81. </view>
  82. <u-button @click="handleNextClick" type="primary" size="middle" style="border-radius: 20rpx;">下一步</u-button>
  83. </view>
  84. </template>
  85. <script>
  86. import picComp from './picComp.vue'
  87. import imgUploadAndDownLoad from '../mixin/imgUploadAndDownLoad.js'
  88. export default {
  89. mixins: [imgUploadAndDownLoad],
  90. props: {
  91. orderDetail: {
  92. type: Object,
  93. default: () => { },
  94. },
  95. orderId: {
  96. type: String,
  97. default: '',
  98. },
  99. currentReceipt: {
  100. type: Object,
  101. default: () => { },
  102. },
  103. },
  104. components: {
  105. picComp
  106. },
  107. data() {
  108. return {
  109. //展示的图片列表
  110. trueUploadList: [],
  111. chatRecordsUploadList: [],
  112. // 待绑定的图片列表
  113. bindList: [],
  114. }
  115. },
  116. watch: {
  117. // 监听 props 变化,触发请求
  118. orderDetail: {
  119. handler(newVal) {
  120. if (newVal) {
  121. console.log('orderDetail 变化了', newVal);
  122. }
  123. }
  124. },
  125. currentReceipt: {
  126. handler(newVal) {
  127. console.log('currentReceipt 变化了', newVal);
  128. if (newVal) {
  129. //刷新图片列表
  130. this.getList('2', '1', newVal.id);
  131. this.getList('2', '2', newVal.id);
  132. }
  133. }
  134. },
  135. },
  136. methods: {
  137. // 电话卡片点击事件
  138. handlePhoneClick() {
  139. console.log('电话卡片被点击', '电话号码:', this.orderDetail.phone)
  140. if (this.orderDetail.phone) {
  141. //拨打电话
  142. // uni.makePhoneCall({
  143. // phoneNumber: this.orderDetail.phone,
  144. // success: () => {
  145. // this.$store.commit("call/SET_FORM", {
  146. // clueId: this.orderDetail.clueId,
  147. // type: "3",
  148. // callee: this.orderDetail.phone,
  149. // });
  150. // },
  151. // });
  152. //先暂时复制电话号码
  153. uni.setClipboardData({
  154. data: this.orderDetail.phone,
  155. success: () => {
  156. uni.showToast({
  157. title: '电话号码已复制',
  158. icon: 'none'
  159. })
  160. }
  161. })
  162. } else {
  163. uni.showToast({
  164. title: '该订单暂时没有电话号码',
  165. icon: 'none'
  166. })
  167. }
  168. },
  169. // 微信卡片点击事件
  170. handleWechatClick() {
  171. console.log('微信卡片被点击', '微信号:', this.orderDetail.wechat)
  172. if (this.orderDetail.wechat) {
  173. //复制微信号
  174. uni.setClipboardData({
  175. data: this.orderDetail.wechat,
  176. success: () => {
  177. uni.showToast({
  178. title: '微信号已复制',
  179. icon: 'none'
  180. })
  181. }
  182. })
  183. } else {
  184. uni.showToast({
  185. title: '该订单暂时没有微信号',
  186. icon: 'none'
  187. })
  188. }
  189. },
  190. // 下一步
  191. handleNextClick() {
  192. // 校验表单
  193. // if (!this.form.truePic.length) {
  194. // uni.showToast({
  195. // title: '请上传实物图',
  196. // icon: 'none'
  197. // })
  198. // return
  199. // }
  200. // if (!this.form.chatRecords.length) {
  201. // uni.showToast({
  202. // title: '请上传聊天记录',
  203. // icon: 'none'
  204. // })
  205. // return
  206. // }
  207. this.$emit('handleNextClick', {
  208. nowPage: 'formOne',
  209. form: this.form,
  210. })
  211. },
  212. //一键复制
  213. copyAllImages() {
  214. // 合并所有图片
  215. const allImages = [...this.trueUploadList, ...this.chatRecordsUploadList];
  216. //取出所有图的url
  217. const allUrls = allImages.map(item => item.fileUrl);
  218. console.log('所有图片:', allUrls)
  219. console.log('合并后的图片列表:', allUrls)
  220. if (allUrls.length > 0) {
  221. // 复制到剪贴板
  222. uni.setClipboardData({
  223. data: JSON.stringify(allUrls),
  224. success: () => {
  225. uni.showToast({
  226. title: '所有图片已复制',
  227. icon: 'none'
  228. })
  229. }
  230. })
  231. } else {
  232. uni.showToast({
  233. title: '没有图片可复制',
  234. icon: 'none'
  235. })
  236. }
  237. },
  238. },
  239. }
  240. </script>
  241. <style scoped lang="scss">
  242. // 导入公共样式
  243. @import './common.scss';
  244. // 主样式
  245. .page-itemOne {
  246. @extend .page-container;
  247. }
  248. .page-itemOne-title {
  249. @include font-styles($size: title, $weight: bold, $color: primary);
  250. }
  251. .page-itemOne-form {
  252. @include font-styles($size: tiny, $weight: semi-bold, $color: secondary);
  253. text-wrap: nowrap;
  254. }
  255. .image-upload-container {
  256. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  257. }
  258. .image-list {
  259. display: flex;
  260. flex-wrap: wrap;
  261. gap: 20rpx;
  262. }
  263. .image-item {
  264. position: relative;
  265. width: 200rpx;
  266. height: 200rpx;
  267. box-sizing: border-box;
  268. }
  269. .delete-btn {
  270. position: absolute;
  271. top: -10rpx;
  272. right: -10rpx;
  273. width: 40rpx;
  274. height: 40rpx;
  275. background-color: #ff4d4f;
  276. color: #fff;
  277. border-radius: 50%;
  278. display: flex;
  279. align-items: center;
  280. justify-content: center;
  281. @include font-styles($size: tiny, $weight: bold);
  282. z-index: 10;
  283. }
  284. .upload-btn {
  285. width: 200rpx;
  286. height: 200rpx;
  287. border: 8rpx dashed #ddd;
  288. border-radius: 30rpx;
  289. display: flex;
  290. align-items: center;
  291. justify-content: center;
  292. background-color: #f9f9f9;
  293. box-sizing: border-box;
  294. }
  295. /* 基本信息卡片样式 */
  296. .info-card {
  297. @include card;
  298. margin-top: 20rpx;
  299. margin-bottom: 20rpx;
  300. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  301. &:hover {
  302. @include shadow(2);
  303. }
  304. }
  305. .info-card-title {
  306. @include font-styles($size: title, $weight: bold, $color: primary);
  307. margin-bottom: 25rpx;
  308. padding-bottom: 15rpx;
  309. border-bottom: 1rpx solid map-get($colors, border);
  310. }
  311. .info-row {
  312. margin-bottom: 20rpx;
  313. }
  314. .info-label {
  315. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  316. margin-bottom: 8rpx;
  317. }
  318. .info-value {
  319. @include font-styles($size: small, $weight: regular, $color: secondary, $line-height: small);
  320. word-break: break-all;
  321. }
  322. /* 联系方式卡片样式 */
  323. .connect {
  324. display: flex;
  325. justify-content: space-between;
  326. margin: 20rpx 0;
  327. gap: 20rpx;
  328. }
  329. .connect-card {
  330. flex: 1;
  331. @include card;
  332. padding: 30rpx;
  333. display: flex;
  334. flex-direction: column;
  335. align-items: center;
  336. box-sizing: border-box;
  337. position: relative;
  338. &:hover {
  339. @include shadow(2);
  340. }
  341. }
  342. .connect-title {
  343. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  344. margin-bottom: 8rpx;
  345. }
  346. .connect-value {
  347. @include font-styles($size: small, $weight: medium, $color: secondary);
  348. }
  349. /* 小红点样式 */
  350. .red-dot {
  351. position: absolute;
  352. top: 15rpx;
  353. right: 15rpx;
  354. width: 25rpx;
  355. height: 25rpx;
  356. background-color: #ff4d4f;
  357. border-radius: 50%;
  358. box-shadow: 0 0 4rpx rgba(255, 77, 79, 0.3);
  359. }
  360. </style>